#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
int p[MAXN];
vector<int> G[MAXN];
int n, m, Q, tot;
int used[MAXN];
int arr[MAXN];
int cha[MAXN];
int Find(int x) { return x == p[x] ? x : p[x] = Find(p[x]); }
int root;
int ans;
int dfs(int u) {
  used[u] = 1;
  int tmp[3] = {0};
  cha[u] = root;
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (!used[v]) {
      tmp[2] = dfs(v);
      if (tmp[1] < tmp[2]) swap(tmp[1], tmp[2]);
      if (tmp[0] < tmp[1]) swap(tmp[0], tmp[1]);
    }
  }
  ans = max(ans, tmp[1] + tmp[0] + 1);
  return tmp[0] + 1;
}
int main() {
  scanf("%d%d%d", &n, &m, &Q);
  for (int i = 1; i <= m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (!used[i]) {
      root = ++tot;
      ans = 0;
      dfs(i);
      arr[tot] = ans;
    }
  }
  for (int i = 1; i <= tot; i++) {
    p[i] = i;
  }
  while (Q--) {
    int op, x, y;
    scanf("%d%d", &op, &x);
    if (op == 1) {
      printf("%d\n", arr[Find(cha[x])] - 1);
    } else {
      scanf("%d", &y);
      int X = Find(cha[x]);
      int Y = Find(cha[y]);
      if (X == Y) continue;
      p[X] = Y;
      int t1, t2;
      if (arr[X] <= 2)
        t1 = arr[X];
      else
        t1 = arr[X] - (arr[X] - 1) / 2;
      if (arr[Y] <= 2)
        t2 = arr[Y];
      else
        t2 = arr[Y] - (arr[Y] - 1) / 2;
      arr[Y] = max(arr[X], arr[Y]);
      arr[Y] = max(arr[Y], t1 + t2);
    }
  }
  return 0;
}
