#include <bits/stdc++.h>
using namespace std;
int n, m, q, maxi, maxiV;
vector<vector<int> > g;
vector<char> used;
vector<int> parent;
vector<int> ranksnm;
vector<int> diam;
int rad(int x) { return (diam[x] + 1) / 2; }
int find_set(int v) {
  if (v == parent[v]) return v;
  return parent[v] = find_set(parent[v]);
}
void union_set(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (ranksnm[a] < ranksnm[b]) swap(a, b);
    parent[b] = a;
    if (ranksnm[a] == ranksnm[b]) ranksnm[a]++;
    diam[a] = max(rad(a) + rad(b) + 1, max(diam[a], diam[b]));
  }
}
void dfs(int v, int depth, int p) {
  if (depth > maxi) {
    maxi = depth;
    maxiV = v;
  }
  for (int to : g[v]) {
    if (to != p) dfs(to, depth + 1, v);
  }
}
int find_diameter(int v) {
  maxi = -1;
  dfs(v, 0, -1);
  maxi = -1;
  dfs(maxiV, 0, -1);
  return maxi;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> q;
  g.resize(n);
  used.resize(n + 5, 0);
  diam.resize(n + 5, 0);
  ranksnm.resize(n + 5, 0);
  parent.resize(n + 5, 0);
  for (int i = 0; i < n; i++) {
    parent[i] = i;
    ranksnm[i] = 0;
  }
  for (int i = 0; i < m; i++) {
    int fr, to;
    cin >> fr >> to;
    fr--;
    to--;
    g[fr].push_back(to);
    g[to].push_back(fr);
    union_set(fr, to);
  }
  for (int i = 0; i < n; i++) {
    int pp = find_set(i);
    if (!used[pp]) {
      used[pp] = 1;
      diam[pp] = find_diameter(i);
    }
  }
  while (q--) {
    int tmp, x, y;
    cin >> tmp;
    if (tmp == 1) {
      cin >> x;
      cout << diam[find_set(x - 1)] << endl;
    } else {
      cin >> x >> y;
      x--;
      y--;
      union_set(x, y);
    }
  }
  return 0;
}
