#include <bits/stdc++.h>
using namespace std;
const int N = 300005, oo = 0x3f3f3f3f;
int n, m, q, p[N], cost[N], vis[2][N];
vector<int> g[N];
int findset(int u) {
  if (p[u] == u) return u;
  return p[u] = findset(p[u]);
}
void unionset(int a, int b) {
  int x = findset(a), y = findset(b);
  int d1 = max(cost[x], cost[y]);
  d1 = max(d1,
           (cost[x] / 2 + (cost[x] & 1)) + (cost[y] / 2 + (cost[y] & 1)) + 1);
  cost[x] = d1;
  p[y] = x;
}
int bfs(int u, int x) {
  int last;
  queue<int> q;
  q.push(u);
  vis[x][u] = 1;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    last = u;
    for (int i = 0; i < g[u].size(); i++) {
      int v = g[u][i];
      if (!vis[x][v]) {
        if (x) {
          unionset(u, v);
        }
        q.push(v);
        vis[x][v] = vis[x][u] + 1;
      }
    }
  }
  return last;
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) p[i] = i;
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[0][i]) {
      int v = bfs(i, 0);
      v = bfs(v, 1);
      cost[findset(i)] = vis[1][v] - 1;
    }
  }
  while (q--) {
    int a, b, c;
    scanf("%d%d", &a, &b);
    if (a == 1) {
      printf("%d\n", cost[findset(b)]);
    } else {
      scanf("%d", &c);
      if (findset(b) == findset(c)) continue;
      unionset(b, c);
    }
  }
  return 0;
}
