#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793;
const long double DEL = 1e-12;
const int mod = 1000000007;
const int LIM = 100005;
int fpow(int x, int n) {
  int res = 1;
  while (n) {
    if (n & 1) {
      res = res * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void sieve(int n) {
  bool prime[5 * LIM];
  memset(prime, true, sizeof(prime));
  int rootn = (int)sqrt(n);
  for (int p = 2; p <= rootn; p++)
    if (prime[p] == true)
      for (int i = p * p; i <= n; i += p) prime[i] = false;
  prime[1] = 0;
}
int cnt, sum, mid, mx, mn, a[3 * LIM];
int n, m, d, q, t, i, j, k, l, r, x, y, z;
bool f, f1, f2;
string s;
vector<vector<int>> v(3 * LIM);
vector<bool> vis(3 * LIM);
int boss, corner;
vector<int> ans(3 * LIM);
void dfs(int i, int len, int par) {
  vis[i] = 1;
  a[i] = boss;
  if (len > l) {
    corner = i;
    l = len;
  }
  for (auto j : v[i]) {
    if (j != par) {
      dfs(j, (len + 1), i);
    }
  }
}
int bossof(int i) {
  while (i != a[i]) {
    a[i] = a[a[i]];
    i = a[i];
  }
  return i;
}
void unite(int x, int y) {
  x = bossof(x);
  y = bossof(y);
  ans[x] = max(max(ans[x], ans[y]), 1 + (ans[x] + 1) / 2 + (ans[y] + 1) / 2);
  a[y] = x;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> q;
  while (m--) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for ((i) = 1; (i) <= (n); (i)++) {
    if (!vis[i]) {
      boss = i;
      l = -1;
      dfs(i, 0, 0);
      l = -1;
      dfs(corner, 0, 0);
      ans[i] = l;
    }
  }
  while (q--) {
    cin >> z;
    if (z == 1) {
      cin >> x;
      cout << ans[bossof(x)];
      cout << "\n";
    } else {
      cin >> x >> y;
      if (bossof(x) != bossof(y)) {
        unite(x, y);
      }
    }
  }
}
