#include <bits/stdc++.h>
using namespace std;
vector<int> Edge[300005];
int Par[300005], Ht[300005];
void Swap(int *a, int *b) {
  int temp = *a;
  *a = *b;
  *b = temp;
}
int find(int x) {
  if (x != Par[x]) return Par[x] = find(Par[x]);
  return x;
}
void set_union(int x, int y) {
  int parx = find(x);
  int pary = find(y);
  if (parx == pary) return;
  if (Ht[parx] < Ht[pary]) Swap(&parx, &pary);
  Ht[parx] = max(Ht[parx], max(Ht[pary], (int)(ceil(Ht[parx] / 2.0) +
                                               ceil(Ht[pary] / 2.0) + 1)));
  Par[pary] = Par[parx];
}
int MaxHt;
bool vis[300005];
int dfs(int k) {
  int l = Edge[k].size(), M1 = 0, M2 = 0;
  for (int i = 0; i < l; i++) {
    if (vis[Edge[k][i]] == 0) {
      vis[Edge[k][i]] = 1;
      int M = dfs(Edge[k][i]);
      if (M >= M1) {
        M2 = M1;
        M1 = M;
      } else if (M > M2)
        M2 = M;
    }
  }
  MaxHt = max(MaxHt, M1 + M2);
  return M1 + 1;
}
void Components(int n) {
  for (int i = 1; i <= n; i++) {
    MaxHt = 0;
    if (vis[i] == 0) {
      vis[i] = 1;
      dfs(i);
      Ht[find(i)] = MaxHt;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 1; i < 300005; i++) Par[i] = i;
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    if (find(a) == find(b)) continue;
    Edge[a].push_back(b);
    Edge[b].push_back(a);
    set_union(a, b);
  }
  Components(n);
  while (q--) {
    int a;
    cin >> a;
    if (a == 1) {
      int x;
      cin >> x;
      cout << Ht[find(x)] << "\n";
    } else {
      int x, y;
      cin >> x >> y;
      set_union(x, y);
    }
  }
  return 0;
}
