#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int r = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') r = (r << 1) + (r << 3) + c - '0', c = getchar();
  return r * f;
}
int fa[300100];
int find(int x) { return x == fa[x] ? fa[x] : (fa[x] = find(fa[x])); }
vector<int> mp[300100];
int dp[300100];
int len[300100];
int Size[300100];
void dfs(int x, int f) {
  for (int i = 0; i < mp[x].size(); ++i) {
    int y = mp[x][i];
    if (y == f) continue;
    fa[y] = fa[x];
    ++Size[fa[x]];
    dfs(y, x);
    len[find(x)] = max(dp[x] + dp[y] + 1, len[find(x)]);
    dp[x] = max(dp[x], dp[y] + 1);
  }
}
int ediv(int x, int y) { return x / y + (x % y != 0); }
int main() {
  int n = read(), m = read(), q = read();
  for (int i = 1; i <= n; ++i) fa[i] = i;
  for (int i = 1; i <= m; ++i) {
    int u = read(), v = read();
    mp[u].push_back(v);
    mp[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i) {
    if (fa[i] == i) {
      dfs(i, 0);
    }
  }
  for (int i = 1; i <= q; ++i) {
    int op = read();
    if (op == 1) {
      int x = find(read());
      printf("%d\n", len[x]);
    } else {
      int x = find(read()), y = find(read());
      if (x == y) continue;
      if (Size[y] < Size[x]) {
        Size[x] += Size[y];
        len[x] =
            max(max(len[x], len[y]), ediv(len[x], 2) + ediv(len[y], 2) + 1);
        fa[y] = x;
      } else {
        Size[y] += Size[x];
        len[y] =
            max(max(len[x], len[y]), ediv(len[x], 2) + ediv(len[y], 2) + 1);
        fa[x] = y;
      }
    }
  }
}
