#include <bits/stdc++.h>
using namespace std;
vector<int> vec[300005];
vector<int> dt(300005, 0), vis(300005, 0), temp_vis(300005, 0);
struct subset {
  int parent;
  int rank;
};
void dfs(int src, int &far, int count, int &maxcount, int turn) {
  if (turn == 0)
    vis[src] = 1;
  else
    temp_vis[src] = 1;
  count++;
  for (auto it : vec[src]) {
    if (turn == 0) {
      if (vis[it] == 0) {
        if (count >= maxcount) {
          maxcount = count;
          far = it;
        }
        dfs(it, far, count, maxcount, turn);
      }
    } else {
      if (temp_vis[it] == 0) {
        if (count >= maxcount) {
          maxcount = count;
          dfs(it, it, count, maxcount, turn);
        } else
          dfs(it, far, count, maxcount, turn);
      }
    }
  }
}
int find(subset node[], int x) {
  if (node[x].parent != x) node[x].parent = find(node, node[x].parent);
  return node[x].parent;
}
void Union(int x, int y, subset node[]) {
  int xroot = find(node, x);
  int yroot = find(node, y);
  if (node[xroot].rank < node[yroot].rank)
    node[xroot].parent = yroot;
  else if (node[xroot].rank > node[yroot].rank)
    node[yroot].parent = xroot;
  else {
    node[yroot].parent = xroot;
    node[xroot].rank++;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, q;
  cin >> n >> m >> q;
  subset node[n + 1];
  for (int i = 1; i <= n; i++) {
    node[i].parent = i;
    node[i].rank = 0;
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    vec[u].push_back(v);
    vec[v].push_back(u);
    Union(u, v, node);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      int par = find(node, i);
      int far = i;
      int maxcount = 0;
      dfs(i, far, 0, maxcount, 0);
      temp_vis.clear();
      maxcount = 0;
      dfs(far, far, 0, maxcount, 1);
      dt[par] = maxcount;
    }
  }
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int x;
      cin >> x;
      int par = find(node, x);
      cout << dt[par] << "\n";
    } else {
      int u, v;
      cin >> u >> v;
      int xroot = find(node, u);
      int yroot = find(node, v);
      if (xroot != yroot) {
        int val = ((dt[xroot] + 1) / 2 + (dt[yroot] + 1) / 2);
        if (node[xroot].rank >= node[yroot].rank) {
          dt[xroot] = max(dt[xroot], max(dt[yroot], val + 1));
          Union(xroot, yroot, node);
        } else {
          dt[yroot] = max(dt[xroot], max(dt[yroot], val + 1));
          Union(xroot, yroot, node);
        }
      }
    }
  }
  return 0;
}
