#include <bits/stdc++.h>
const int MOD = 1000000;
const int N = 3e5 + 15;
const int maxn = 2000 + 15;
const int INF = (1 << 30) - 1;
const int letter = 130;
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m, q, head[N], tot = 0, father[N], dis[N], aim, vis[N];
struct edges {
  int to, next;
} e[N << 1];
queue<pair<int, int>> que;
void addedge(int u, int v) {
  e[tot].to = v;
  e[tot].next = head[u];
  head[u] = tot++;
}
int Find(int x) {
  if (x == father[x]) return x;
  return father[x] = Find(father[x]);
}
void init(int n) {
  memset(head, -1, sizeof(head)), tot = 0;
  for (int i = 1; i <= n; i++) father[i] = i, dis[i] = -1;
  memset(vis, 0, sizeof(vis));
}
int bfs(int f, int num) {
  while (!que.empty()) que.pop();
  int ans = 0;
  que.push(make_pair(f, 0));
  vis[f] = num;
  int x, to, val;
  while (!que.empty()) {
    x = que.front().first, val = que.front().second;
    que.pop();
    for (int i = head[x]; i != -1; i = e[i].next) {
      to = e[i].to;
      if (vis[to] != num) {
        vis[to] = num;
        ans = max(ans, val + 1);
        que.push(make_pair(to, val + 1));
        aim = to;
      }
    }
  }
  return ans;
}
int main() {
  n = read(), m = read(), q = read();
  int x, y, xx, yy, id;
  init(n);
  for (int i = 0; i < m; i++) {
    x = read(), y = read();
    xx = Find(x), yy = Find(y);
    if (xx != yy) {
      father[xx] = yy;
    }
    addedge(x, y);
    addedge(y, x);
  }
  for (int i = 1; i <= n; i++) {
    xx = Find(i);
    if (dis[xx] == -1) {
      bfs(xx, 1);
      dis[xx] = bfs(aim, 2);
    }
  }
  for (int i = 0; i < q; i++) {
    id = read(), x = read();
    if (id == 1) {
      printf("%d\n", dis[Find(x)]);
    } else {
      y = read();
      xx = Find(x), yy = Find(y);
      if (xx == yy) continue;
      if (dis[xx] > dis[yy]) swap(xx, yy);
      father[xx] = yy;
      dis[yy] = max(dis[yy], 1 + dis[yy] / 2 + dis[xx] / 2 +
                                 (dis[yy] % 2 ? 1 : 0) + (dis[xx] % 2 ? 1 : 0));
    }
  }
  return 0;
}
