#include <bits/stdc++.h>
using namespace std;
int tata[300010], g[300010], ans[300010];
int h[300010];
vector<int> adia[300010];
int farest(int nod, int tata);
int find(int x);
void unite(int x, int y);
int main() {
  int n, m, a, b, q;
  for (int i(0); i <= 300000; i++) ans[i] = 0, g[i] = 1, tata[i] = i;
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> q;
  while (m--) {
    cin >> a >> b;
    adia[a].push_back(b);
    adia[b].push_back(a);
    unite(a, b);
  }
  for (int i(1); i <= n; i++) {
    if (find(i) == i) {
      a = farest(i, 0);
      a = farest(a, 0);
      ans[i] = h[a] - 1;
    }
  }
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      cin >> a;
      cout << ans[find(a)] << '\n';
    } else {
      cin >> a >> b;
      unite(a, b);
    }
  }
  return 0;
}
int find(int x) {
  if (tata[tata[x]] != tata[x]) tata[x] = find(tata[tata[x]]);
  return tata[x];
}
void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return;
  if (g[x] > g[y])
    g[x] += g[y], tata[y] = x,
                  ans[x] = max(max(ans[x], ans[y]),
                               (ans[x] + 1) / 2 + 1 + (ans[y] + 1) / 2);
  else
    g[y] += g[x], tata[x] = y,
                  ans[y] = max(max(ans[x], ans[y]),
                               (ans[x] + 1) / 2 + 1 + (ans[y] + 1) / 2);
}
int farest(int nod, int tata) {
  h[nod] = 1 + h[tata];
  int best(nod);
  for (auto i : adia[nod]) {
    if (i != tata) {
      int c(farest(i, nod));
      if (h[c] > h[best]) best = c;
    }
  }
  return best;
}
