#include <bits/stdc++.h>
using namespace std;
int fa[300100];
bool vist[300100];
vector<int> tr[300100];
int getfa(int x) { return x == fa[x] ? x : fa[x] = getfa(fa[x]); }
int n, m, q;
int maxlen, mi;
int ans[300100];
int dfs(int s, int pa) {
  fa[s] = pa;
  vist[s] = true;
  int d1 = 0, d2 = 0;
  for (int i = 0; i < (int)tr[s].size(); ++i) {
    int v = tr[s][i];
    if (vist[v]) continue;
    int t = dfs(v, pa) + 1;
    if (t > d1)
      d2 = d1, d1 = t;
    else if (t > d2)
      d2 = t;
  }
  maxlen = max(maxlen, d1 + d2);
  return d1;
}
int main() {
  while (~scanf("%d%d%d", &n, &m, &q)) {
    int u, v;
    for (int i = 0; i <= n; ++i) tr[i].clear();
    for (int i = 1; i <= m; ++i) {
      scanf("%d%d", &u, &v);
      tr[u].push_back(v);
      tr[v].push_back(u);
    }
    memset(vist, 0, sizeof(vist));
    memset(ans, 0, sizeof(ans));
    for (int i = 1; i <= n; ++i) {
      if (!vist[i]) {
        maxlen = 0;
        dfs(i, i);
        ans[i] = maxlen;
      }
    }
    int type;
    for (int i = 0; i < q; ++i) {
      scanf("%d%d", &type, &u);
      if (type == 1)
        printf("%d\n", ans[getfa(u)]);
      else {
        scanf("%d", &v);
        int xx = getfa(u), yy = getfa(v);
        if (xx == yy) continue;
        fa[yy] = xx;
        int t = max(max(ans[xx], ans[yy]),
                    (ans[xx] + 1) / 2 + (ans[yy] + 1) / 2 + 1);
        ans[xx] = t;
      }
    }
  }
  return 0;
}
