#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
vector<int> adj[N];
int p[N];
int l[N];
vector<bool> vis(N);
int find(int x) { return p[x] = (p[x] == x ? x : find(p[x])); }
int dfs(int idx) {
  if (vis[idx]) return -1;
  vis[idx] = 1;
  pair<int, int> mx = {0, 0};
  for (int e : adj[idx]) {
    int x = (dfs(e) + 1);
    if (mx.first < x) {
      mx.second = mx.first, mx.first = x;
    } else {
      mx.second = max(mx.second, x);
    }
  }
  l[idx] = mx.first + mx.second;
  return mx.first;
}
void solve() {
  memset(l, 0, sizeof l);
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i <= n; i++) p[i] = i;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
    int su = find(u), sv = find(v);
    if (su != sv) {
      p[su] = sv;
    }
  }
  for (int i = 1; i <= n; i++) dfs(i);
  for (int i = 1; i <= n; i++) {
    int find_i = find(i);
    l[find_i] = max(l[find_i], l[i]);
  }
  vector<int> res;
  while (q--) {
    int typ;
    scanf("%d", &typ);
    if (typ == 1) {
      int x;
      scanf("%d", &x);
      res.push_back(l[find(x)]);
    } else {
      int x, y;
      scanf("%d%d", &x, &y);
      int sx = find(x), sy = find(y);
      if (sx == sy) continue;
      int new_l = max(l[sx], l[sy]);
      new_l = max(new_l, (1 + l[sx]) / 2 + 1 + (1 + l[sy]) / 2);
      p[sx] = sy;
      l[sy] = new_l;
    }
  }
  for (int c : res) {
    printf("%d\n", c);
  }
}
int main() { solve(); }
