#include <bits/stdc++.h>
using namespace std;
int par[int(1e5) * 4], size[int(1e5) * 4], com[int(1e5) * 4];
vector<int> adj[int(1e5) * 4];
bool flag[int(1e5) * 4];
bool flag1[int(1e5) * 4];
int n, m, q, mx, node;
void dfs(int a, int k) {
  flag[a] = true;
  if (k > mx) {
    mx = k;
    node = a;
  }
  for (int i = 0; i < adj[a].size(); i++) {
    if (!flag[adj[a][i]]) dfs(adj[a][i], k + 1);
  }
}
void dfs1(int a, int k) {
  flag1[a] = true;
  if (k > mx) {
    mx = k;
    node = a;
  }
  for (int i = 0; i < adj[a].size(); i++) {
    if (!flag1[adj[a][i]]) dfs1(adj[a][i], k + 1);
  }
}
int find(int a) {
  if (par[a] == a) return a;
  return find(par[a]);
}
void merge(int a, int b) {
  int pa = find(a), push_back = find(b);
  if (pa == push_back) return;
  if (size[pa] > size[push_back]) {
    par[push_back] = pa;
    size[pa] += size[push_back];
  } else {
    par[pa] = push_back;
    size[push_back] += size[pa];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) {
    par[i] = i;
    size[i] = 1;
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
    merge(a, b);
  }
  for (int i = 1; i <= n; i++) {
    if (!flag[i]) {
      node = i;
      dfs(i, 0);
      mx = 0;
      dfs1(node, 0);
      com[find(i)] = mx;
      mx = 0;
    }
  }
  for (int i = 0; i < q; i++) {
    int a;
    cin >> a;
    if (a == 1) {
      int b;
      cin >> b;
      cout << com[find(b)] << endl;
    } else {
      int b, c;
      cin >> b >> c;
      int push_back = find(b), pc = find(c);
      if (push_back != pc) {
        int t = max(com[push_back],
                    max(com[pc], int(ceil(float(com[push_back]) / 2) +
                                     ceil(float(com[pc]) / 2) + 1)));
        merge(b, c);
        com[find(b)] = t;
      }
    }
  }
  return 0;
}
