import java.io.*;
import java.util.*;

public class canalisation_bm {
	FastScanner in;
	PrintWriter out;

	class Ask {
		int fr, to;
		int answer;

		public Ask(int fr, int to) {
			super();
			this.fr = fr;
			this.to = to;
		}
		
	}
	
	ArrayList<Integer> g[];
	ArrayList<Ask> a[];
	boolean[] was;
	int[] next;
	
	void dfs(int v) { 
		was[v] = true;
		for (Ask ask : a[v]) {
			if (was[ask.fr] && was[ask.to])
				ask.answer = next[ask.fr];
		}
		for (int u : g[v])
			if (!was[u]) {
				next[v] = u;
				next[u] = v;
				dfs(u);
				next[u] = v;
			}
	}
	
	void solve() {
		int n = in.nextInt();
		int m = in.nextInt();
		g = new ArrayList[n];
		a = new ArrayList[n];
		for (int i = 0; i < n; i++) {
			g[i] = new ArrayList<Integer>();
			a[i] = new ArrayList<Ask>();
		}
		for (int i = 0; i < n - 1; i++) {
			int fr = in.nextInt() - 1;
			int to = in.nextInt() - 1;
			g[fr].add(to);
			g[to].add(fr);
		}
		ArrayList<Ask> ans = new ArrayList<Ask>();
		for (int i = 0; i < m; i++) {
			int fr = in.nextInt() - 1;
			int to = in.nextInt() - 1;
			Ask tmp = new Ask(fr, to);
			a[fr].add(tmp);
			a[to].add(tmp);
			ans.add(tmp);
		}
		next = new int[n];
		was = new boolean[n];
		dfs(0);
		for (int i = 0; i < m; i++) {
			out.println(ans.get(i).answer + 1);
		}
	}

	void run() {
		try {
			in = new FastScanner(new File("canalisation.in"));
			out = new PrintWriter(new File("canalisation.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

	public static void main(String[] args) {
		new canalisation_bm().run();
	}
}