#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int cut, head[300030], ver[600060], kkkkfgdsg[600060];
int f[300030], dep[300030], st, maxx, dis[300030], book[300030];
void add(int x, int y) {
  ver[++cut] = y;
  kkkkfgdsg[cut] = head[x];
  head[x] = cut;
}
int getf(int v) {
  if (f[v] == v) return v;
  return f[v] = getf(f[v]);
}
void dfs(int x, int vv) {
  if (maxx < vv) maxx = vv, st = x;
  for (int ii = head[x]; ii; ii = kkkkfgdsg[ii]) {
    int y = ver[ii];
    if (!book[y]) book[y] = 1, dfs(y, vv + 1);
  }
  book[x] = 0;
}
void dfs2(int x, int vv) {
  if (maxx < vv) maxx = vv;
  for (int ii = head[x]; ii; ii = kkkkfgdsg[ii]) {
    int y = ver[ii];
    if (!book[y]) book[y] = 1, dfs(y, vv + 1);
  }
  book[x] = 0;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i) f[i] = i;
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
    f[getf(x)] = getf(y);
  }
  for (int i = 1; i <= n; ++i) {
    int t = getf(i);
    if (t != i) continue;
    maxx = -1;
    book[t] = 1;
    dfs(t, 0);
    maxx = -1;
    book[st] = 1;
    dfs2(st, 0);
    dis[t] = maxx;
  }
  while (q--) {
    int a;
    scanf("%d", &a);
    if (a == 1) {
      int x;
      scanf("%d", &x);
      printf("%d\n", dis[getf(x)]);
    } else {
      int x, y;
      scanf("%d%d", &x, &y);
      int t1 = getf(x), t2 = getf(y);
      if (t1 == t2) continue;
      dis[t2] =
          max(max((dis[t1] + 1) / 2 + (dis[t2] + 1) / 2 + 1, dis[t1]), dis[t2]);
      f[getf(t1)] = getf(t2);
    }
  }
  return 0;
}
