#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 10;
int par[MAXN];
int mp[MAXN];
bool vis[MAXN];
vector<int> adj[MAXN];
int dfs(int x, int root) {
  vis[x] = 1;
  int m1 = -1, m2 = -1;
  for (int i = 0; i < adj[x].size(); i++) {
    int v = adj[x][i];
    if (vis[v] == 0) {
      int t = dfs(v, root);
      if (t > m1) {
        m2 = m1;
        m1 = t;
      } else if (t > m2)
        m2 = t;
    }
  }
  mp[root] = max(mp[root], m1 + m2 + 2);
  return m1 + 1;
}
int fin(int x) {
  if (par[x] != x) par[x] = fin(par[x]);
  return par[x];
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) par[i] = i;
  while (m--) {
    int a, b;
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
    par[fin(a)] = fin(b);
  }
  for (int i = 1; i <= n; i++) {
    if (par[i] == i) dfs(i, i);
  }
  while (q--) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int x;
      scanf("%d", &x);
      cout << mp[fin(x)] << endl;
    } else {
      int x, y;
      scanf("%d%d", &x, &y);
      x = fin(x);
      y = fin(y);
      if (x != y) {
        int t = max(mp[x], mp[y]);
        par[x] = y;
        mp[y] = max(t, (mp[x] + 1) / 2 + (mp[y] + 1) / 2 + 1);
      }
    }
  }
  return 0;
}
