#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
char ss[1 << 17], *A = ss, *B = ss;
inline char gc() {
  if (A == B) {
    B = (A = ss) + fread(ss, 1, 1 << 17, stdin);
    if (A == B) return EOF;
  }
  return *A++;
}
int read() {
  int x = 0, f = 1;
  char ch = gc();
  for (; !isdigit(ch); ch = gc())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = gc()) x = (x << 3) + (x << 1) + ch - 48;
  return x * f;
}
int n, q, x, y, las = 0, ans = 1e9, f[N];
int cnt, head[N], to[N << 1], nxt[N << 1];
void add(int u, int v) { nxt[++cnt] = head[u], to[cnt] = v, head[u] = cnt; }
void dfs(int u, int fa) {
  f[u] = min(f[fa], u);
  for (int i = head[u]; i; i = nxt[i])
    if (to[i] != fa) dfs(to[i], u);
}
int main() {
  n = read(), q = read() - 1;
  memset(f, 0x3f, sizeof(f));
  for (int i = 1; i < n; i++) x = read(), y = read(), add(x, y), add(y, x);
  x = read(), y = read() % n + 1;
  dfs(y, 0);
  while (q--) {
    x = read(), y = (read() + las) % n + 1;
    if (x == 1)
      ans = min(ans, f[y]);
    else
      las = min(ans, f[y]), printf("%d\n", las);
  }
}
