#include <bits/stdc++.h>
using namespace std;
vector<int> c[300002];
int a, b, n, m, q, t, i, root, ans, x, y, way[300002], f[300002];
int father(int k) {
  if (f[k] == k)
    return f[k];
  else
    return f[k] = father(f[k]);
}
void slove(int x, int y) {
  int p, v, t, g, h;
  t = father(x);
  v = father(y);
  if (t == v) return;
  p = max(way[t], way[v]);
  g = way[t];
  h = way[v];
  f[t] = v;
  way[v] = max(p, (++g) / 2 + (++h) / 2 + 1);
}
void dfs(int k, int l, int d) {
  f[k] = root;
  if (d > ans) {
    ans = d;
    t = k;
  }
  vector<int>::iterator it;
  for (it = c[k].begin(); it != c[k].end(); it++)
    if (*it != l) dfs(*it, k, d + 1);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i <= n; i++) c[i].clear();
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a, &b);
    c[a].push_back(b);
    c[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) f[i] = i;
  for (int i = 1; i <= n; i++)
    if (f[i] == i) {
      root = i;
      ans = -1;
      dfs(i, 0, 0);
      ans = -1;
      dfs(t, 0, 0);
      way[i] = ans;
    }
  for (int i = 1; i <= q; i++) {
    scanf("%d", &a);
    if (a == 1) {
      scanf("%d", &x);
      cout << way[father(x)] << endl;
    } else {
      scanf("%d%d", &x, &y);
      slove(x, y);
    }
  }
  return 0;
}
