#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 1e2;
vector<int> v[maxn];
int f[maxn], fa[maxn];
inline void dfs(int pos) {
  f[pos] = min(pos, fa[pos] ? f[fa[pos]] : maxn);
  for (auto t : v[pos])
    if (t != fa[pos]) fa[t] = pos, dfs(t);
}
int main() {
  static int n, m, root, mi = maxn;
  scanf("%d%d", &n, &m);
  for (int i = 1, a, b; i < n; i++)
    scanf("%d%d", &a, &b), v[a].push_back(b), v[b].push_back(a);
  scanf("%*d%d", &root), root = root % n + 1, dfs(root);
  for (int i = 1, t, z, ans = 0; i < m; i++) {
    scanf("%d%d", &t, &z), z = (z + ans) % n + 1;
    if (t == 1)
      mi = min(mi, f[z]);
    else
      printf("%d\n", ans = min(f[z], mi));
  }
  return 0;
}
