#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int n, m, q;
vector<int> g[300020];
int fa[300020];
int lenth[300020];
int rec, root, ans;
void init() {
  for (int i = 1; i <= n; i++) {
    g[i].clear();
    fa[i] = i;
  }
}
void DFS(int u, int p, int d) {
  fa[u] = root;
  if (d > ans) {
    rec = u;
    ans = d;
  }
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == p) continue;
    DFS(v, u, d + 1);
  }
}
int Find(int v) { return fa[v] = fa[v] == v ? v : Find(fa[v]); }
void Link(int a, int b) {
  int x = Find(a);
  int y = Find(b);
  if (x == y) return;
  if (lenth[x] < lenth[y]) swap(lenth[x], lenth[y]);
  fa[y] = x;
  lenth[x] = max(lenth[x], ((lenth[x] + 1) / 2 + (lenth[y] + 1) / 2 + 1));
}
int main() {
  int a, b;
  scanf("%d%d%d", &n, &m, &q);
  init();
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (fa[i] != i) continue;
    root = rec = i;
    ans = -1;
    DFS(i, 0, 0);
    ans = -1;
    DFS(rec, 0, 0);
    lenth[i] = ans;
  }
  int op;
  for (int i = 0; i < q; i++) {
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d", &a);
      b = Find(a);
      printf("%d\n", lenth[b]);
    } else {
      scanf("%d%d", &a, &b);
      Link(a, b);
    }
  }
  return 0;
}
