#include <bits/stdc++.h>
using namespace std;
vector<int> v[300005];
int par[300005];
int dia[300005];
int no;
int vis[2][300005];
int root(int b) {
  while (b != par[b]) {
    par[b] = par[par[b]];
    b = par[b];
  }
  return b;
}
void un(int c, int b) {
  if (root(c) != root(b)) {
    par[root(c)] = par[root(b)];
  }
}
int ed;
int flg = 0;
int mx;
int bst;
void dfs(int a, int b, int dep) {
  mx = max(mx, dep);
  vis[b][a] = 1;
  if (dep > bst) {
    bst = dep, ed = a;
  }
  for (auto j : v[a]) {
    if (!vis[b][j]) {
      vis[b][j] = 1;
      dfs(j, b, dep + 1);
    }
  }
  if (flg == 0) {
    flg = 1;
    ed = a;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) par[i] = i;
  int a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    un(a, b);
    v[a].emplace_back(b);
    v[b].emplace_back(a);
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[0][i]) {
      mx = 0, bst = -1, ed = -1;
      dfs(i, 0, 0);
      mx = 0, bst = -1;
      dfs(ed, 1, 0);
      flg = 0;
      dia[root(i)] = mx;
      mx = 0;
    }
  }
  int c;
  for (int i = 0; i < q; i++) {
    cin >> a;
    if (a == 1) {
      cin >> b;
      cout << dia[root(b)] << "\n";
    } else {
      cin >> b >> c;
      if (root(b) != root(c)) {
        int f = dia[root(b)];
        int h = dia[root(c)];
        double s = ceil(f / 2.0);
        double x = ceil(h / 2.0);
        int g = max(f, max(h, ((int)s + (int)x + 1)));
        un(b, c);
        dia[root(b)] = g;
      }
    }
  }
}
