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

public class canalisation_akov {
	FastScanner in;
	PrintWriter out;

	class Request {
		int l, r, num;

		public Request(int l, int r, int num) {
			super();
			this.l = l;
			this.r = r;
			this.num = num;
		}
	}

	int n, m;
	ArrayList<Integer>[] g;
	ArrayList<Request>[] requestL, requestR;
	boolean[] was;
	int[] go, ans;
	
	void dfs(int v, int p) {
		was[v] = true;
		for (Request req : requestL[v]) {
			if (was[req.r]) {
				ans[req.num] = p;
			}
		}
		for (Request req : requestR[v]) {
			if (was[req.l]) {
				ans[req.num]= go[req.l]; 
			}
		}
		for (int x : g[v]) {
			if (!was[x]) {
				go[v] = x;
				dfs(x, v);
			}
		}
		go[v] = p;
	}
	
	public void solve() throws IOException {
		n = in.nextInt();
		m = in.nextInt();
		g = new ArrayList[n];
		requestL = new ArrayList[n];
		requestR = new ArrayList[n];
		was = new boolean[n];
		go = new int[n];
		ans = new int[m];
		for (int i = 0; i < n; i++) {
			g[i] = new ArrayList<Integer>();
			requestL[i] = new ArrayList<Request>();
			requestR[i] = new ArrayList<Request>();
		}
		for (int i = 0; i < n - 1; i++) {
			int a = in.nextInt() - 1, b = in.nextInt() - 1;
			g[a].add(b);
			g[b].add(a);
		}
		for (int i = 0; i < m; i++) {
			Request cur = new Request(in.nextInt() - 1, in.nextInt() - 1, i);
			requestL[cur.l].add(cur);
			requestR[cur.r].add(cur);
		}
		dfs(0, -1);
		for (int cur : ans) {
			out.println(cur + 1);
		}
	}

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

			solve();

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

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	public static void main(String[] arg) {
		new canalisation_akov().run();
	}
}