#include <bits/stdc++.h>
using namespace std;
int ata[(int)(3e5 + 10)], a, b, c, n, m, q, temp, lp[(int)(3e5 + 10)];
vector<int> V[(int)(3e5 + 10)];
pair<int, int> mx;
int atabul(int x) { return x == ata[x] ? x : ata[x] = atabul(ata[x]); }
void dfs(int x, int path, int par) {
  mx = max(mx, make_pair(path, x));
  ata[x] = temp;
  for (__typeof(V[x].begin()) it = V[x].begin(); it != V[x].end(); it++)
    if (*it != par) dfs(*it, path + 1, x);
}
void merge(int x, int y) {
  int xx = atabul(x);
  int yy = atabul(y);
  if (xx == yy) return;
  lp[xx] = max(lp[xx], max(lp[yy], (lp[xx] + 1) / 2 + (lp[yy] + 1) / 2 + 1));
  ata[yy] = xx;
}
int main() {
  cin >> n >> m >> q;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &a, &b);
    V[a].push_back(b);
    V[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (ata[i]) continue;
    temp = i;
    mx = make_pair(-1, -1000000007);
    dfs(i, 0, -1);
    int tmp = mx.second;
    mx = make_pair(-1, -1000000007);
    dfs(tmp, 0, -1);
    lp[i] = mx.first;
  }
  for (int qq = 1; qq <= q; qq++) {
    scanf("%d", &c);
    if (c == 1) {
      scanf("%d", &a);
      printf("%d\n", lp[atabul(a)]);
    } else {
      scanf("%d %d", &a, &b);
      merge(a, b);
    }
  }
}
