#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int INF = 1e9;
vector<int> G[N];
int rec[N];
void dfs(int x, int fa, int minx) {
  rec[x] = min(x, minx);
  for (int i = 0; i < G[x].size(); i++) {
    if (G[x][i] == fa) continue;
    dfs(G[x][i], x, rec[x]);
  }
}
int main() {
  int n, q, u, v, ty, x, ans, minx;
  scanf("%d %d", &n, &q);
  for (int i = 1; i <= n - 1; i++) {
    scanf("%d %d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  scanf("%d %d", &ty, &x);
  x = (x % n) + 1;
  dfs(x, -1, INF);
  ans = 0;
  minx = x;
  for (int i = 2; i <= q; i++) {
    scanf("%d %d", &ty, &x);
    x = ((x + ans) % n) + 1;
    if (ty == 1)
      minx = min(minx, rec[x]);
    else {
      ans = min(minx, rec[x]);
      printf("%d\n", ans);
    }
  }
  return 0;
}
