#include <bits/stdc++.h>
using namespace std;
bool vis[300010];
int mx, h, s, f[300010];
int r[300010];
int n, m, q;
vector<int> V[300010];
void dfs(int u, int h, int Pred = -1) {
  vis[u] = true;
  if (h >= mx) {
    mx = h;
    s = u;
  }
  for (int i = 0; i < V[u].size(); i++) {
    int v = V[u][i];
    if (v == Pred) continue;
    dfs(v, h + 1, u);
  }
}
void ffs(int u, int h, int Pred = -1) {
  f[u] = s;
  if (h > mx) mx = h;
  for (int i = 0; i < V[u].size(); i++) {
    int v = V[u][i];
    if (v == Pred) continue;
    ffs(v, h + 1, u);
  }
}
int Find(int u) {
  if (f[u] != u) f[u] = Find(f[u]);
  return f[u];
}
int Merge(int u, int v) {
  int f1 = Find(u), f2 = Find(v);
  if (f1 == f2) return 0;
  f[f2] = f1;
  r[f1] = max(r[f1], (r[f1] / 2 + r[f1] % 2) + (r[f2] / 2 + r[f2] % 2) + 1);
  r[f1] = max(r[f1], r[f2]);
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    V[u].push_back(v);
    V[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) f[i] = i;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      mx = 0;
      s = 0;
      dfs(i, 0);
      mx = 0;
      ffs(s, 0);
      r[s] = mx;
    }
  for (int i = 1; i <= q; i++) {
    int k, u, v;
    scanf("%d", &k);
    if (k == 1) {
      scanf("%d", &u);
      printf("%d\n", r[Find(u)]);
    } else {
      scanf("%d%d", &u, &v);
      Merge(u, v);
    }
  }
  return 0;
}
