#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int _inf = 0xc0c0c0c0;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long _INF = 0xc0c0c0c0c0c0c0c0;
const long long mod = (int)1e9 + 7;
const int N = 3e5 + 100;
int pre[N];
int len[N];
int Find(int x) {
  if (x == pre[x]) return x;
  return pre[x] = Find(pre[x]);
}
void Merge(int u, int v) {
  u = Find(u);
  v = Find(v);
  if (u == v) return;
  pre[v] = u;
  int l1 = len[u] / 2 + (len[u] & 1), l2 = len[u] / 2;
  int l11 = l1 + 1;
  int l3 = len[v] / 2 + (len[v] & 1), l4 = len[v] / 2;
  int l33 = l3 + 1;
  int llen1 = l3 + l4 + l11 - min({l11, l3, l4});
  int llen2 = l1 + l2 + l33 - min({l33, l1, l2});
  len[u] = max(llen1, llen2);
}
vector<int> vc[N];
int dfs(int rt, int o, int u) {
  pre[u] = rt;
  int llen[2] = {0, 0};
  for (int v : vc[u]) {
    if (v == o) continue;
    int tt = dfs(rt, u, v);
    if (tt > llen[0]) swap(llen[0], tt);
    if (tt > llen[1]) swap(llen[1], tt);
  }
  len[rt] = max(len[rt], llen[0] + llen[1]);
  return llen[0] + 1;
}
int main() {
  int n, m, p, u, v;
  scanf("%d%d%d", &n, &m, &p);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &u, &v);
    vc[u].push_back(v);
    vc[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i) pre[i] = i;
  for (int i = 1; i <= n; ++i) {
    if (Find(i) == i) {
      dfs(i, 0, i);
    }
  }
  int op, x, y;
  for (int i = 1; i <= p; ++i) {
    scanf("%d", &op);
    if (op == 1) {
      scanf("%d", &x);
      printf("%d\n", len[Find(x)]);
    } else {
      scanf("%d%d", &x, &y);
      Merge(x, y);
    }
  }
  return 0;
}
