#include <bits/stdc++.h>
using namespace std;
int n, m, k, x, y, i, j, s, mx, p[300005], r[300005];
char u[300005];
vector<int> q[300005];
void dfs(int v, int h) {
  u[v] = true;
  if (h >= mx) {
    mx = h;
    s = v;
  }
  for (int i = 0; i < q[v].size(); i++)
    if (!u[q[v][i]]) dfs(q[v][i], h + 1);
}
void ffs(int v, int h, int pred = -1) {
  if (h > mx) mx = h;
  p[v] = s;
  for (int i = 0; i < q[v].size(); i++)
    if (q[v][i] != pred) ffs(q[v][i], h + 1, v);
}
int findset(int x) {
  if (x == p[x]) return x;
  p[x] = findset(p[x]);
  return p[x];
}
void uni(int x, int y) {
  x = findset(x);
  y = findset(y);
  {
    r[x] = max(r[x], (r[x] / 2 + r[x] % 2) + (r[y] / 2 + r[y] % 2) + 1);
    r[x] = max(r[x], r[y]);
    p[y] = x;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (i = 1; i <= m; i++) {
    cin >> x >> y;
    q[x].push_back(y);
    q[y].push_back(x);
  }
  for (i = 1; i <= n; i++)
    if (!u[i]) {
      mx = 0;
      s = 0;
      dfs(i, 0);
      mx = 0;
      ffs(s, 0);
      r[s] = mx;
    }
  for (i = 1; i <= k; i++) {
    cin >> x;
    if (x == 1) {
      cin >> y;
      cout << r[findset(y)] << endl;
    } else {
      cin >> x >> y;
      if (findset(x) != findset(y)) uni(x, y);
    }
  }
}
