#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  return (b) == 0 ? (a) : gcd((b), ((a) % (b)));
}
template <class T>
inline T lcm(T a, T b) {
  return ((a) / gcd((a), (b)) * (b));
}
template <class T>
inline T BigMod(T Base, T power, T M = 1000000007) {
  if (power == 0) return 1;
  if (power & 1)
    return ((Base % M) * (BigMod(Base, power - 1, M) % M)) % M;
  else {
    T y = BigMod(Base, power / 2, M) % M;
    return (y * y) % M;
  }
}
template <class T>
inline T ModInv(T A, T M = 1000000007) {
  return BigMod(A, M - 2, M);
}
int fx[] = {-1, +0, +1, +0, +1, +1, -1, -1, +0};
int fy[] = {+0, -1, +0, +1, +1, -1, +1, -1, +0};
int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int mata[300005], vis[300005], mm[300005];
vector<int> v[300005];
int findMata(int s) {
  if (mata[s] == s) return s;
  return mata[s] = findMata(mata[s]);
}
int mx, save;
void dfs(int s, int p, int l) {
  if (l > mx) {
    mx = l;
    save = s;
  }
  for (auto it : v[s]) {
    if (it == p) continue;
    dfs(it, s, l + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) mata[i] = i;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
    int x = findMata(a);
    int y = findMata(b);
    mata[x] = y;
  }
  for (int i = 1; i <= n; i++) {
    int x = findMata(i);
    if (vis[x] == 0) {
      mx = -1, save = 0;
      vis[x] = 1;
      dfs(i, 0, 0);
      dfs(save, 0, 0);
      mm[x] = mx;
    }
  }
  for (int i = 0; i < q; i++) {
    int c, x, y;
    cin >> c;
    if (c == 1) {
      cin >> x;
      cout << mm[findMata(mata[x])] << endl;
    } else {
      cin >> x >> y;
      int xx = findMata(x);
      int yy = findMata(y);
      if (xx != yy) {
        mm[yy] =
            max(mm[xx], max(mm[yy], (mm[xx] + 1) / 2 + (mm[yy] + 1) / 2 + 1));
        mata[xx] = yy;
      }
    }
  }
  return 0;
}
