#include <bits/stdc++.h>
const int MAXN = 1000000;
using namespace std;
int N, M, Q, e;
int fa[MAXN], head[MAXN], Rank[MAXN], s[MAXN];
int deep[MAXN], Max_deep, s_p;
bool vis[MAXN];
struct node {
  int next, v;
} edge[MAXN];
inline void addedge(int u, int v) {
  edge[++e] = (node){head[u], v};
  head[u] = e;
}
inline int read() {
  int x = 0;
  char ch = getchar();
  while (ch < '0' || '9' < ch) {
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
int Get_fa(int x) { return fa[x] != x ? fa[x] = Get_fa(fa[x]) : x; }
inline int cnt(int x, int y) {
  int sum = 1;
  sum += x % 2 == 0 ? (x / 2) : (x / 2 + 1);
  sum += y % 2 == 0 ? (y / 2) : (y / 2 + 1);
  return sum;
}
inline void Union(int x, int y) {
  int fx = Get_fa(x);
  int fy = Get_fa(y);
  if (Rank[fx] > Rank[fy]) {
    fa[fy] = fx;
    Rank[fx] += Rank[fy];
    s[fx] = max(max(s[fx], s[fy]), cnt(s[fx], s[fy]));
  } else {
    fa[fx] = fy;
    Rank[fy] += Rank[fx];
    s[fy] = max(max(s[fx], s[fy]), cnt(s[fx], s[fy]));
  }
}
void dfs(int x, int fa, int h) {
  vis[x] = true;
  if (Max_deep < h) {
    Max_deep = h;
    s_p = x;
  }
  for (int i = head[x]; i; i = edge[i].next) {
    int v = edge[i].v;
    if (v == fa) {
      continue;
    }
    dfs(v, x, h + 1);
  }
}
int main() {
  N = read();
  M = read();
  Q = read();
  for (int i = 1; i <= N; i++) {
    fa[i] = i;
    Rank[i] = 1;
  }
  int u, v;
  int k, x, y, fx, fy;
  for (int i = 1; i <= M; i++) {
    u = read();
    v = read();
    fx = Get_fa(u);
    fy = Get_fa(v);
    if (fx != fy) {
      Union(fx, fy);
      addedge(u, v);
      addedge(v, u);
    }
  }
  for (int i = 1; i <= N; i++) {
    if (!vis[i]) {
      Max_deep = 1;
      s_p = i;
      dfs(i, 0, 1);
      dfs(s_p, 0, 1);
      fx = Get_fa(i);
      s[fx] = Max_deep - 1;
    }
  }
  for (int i = 1; i <= Q; i++) {
    k = read();
    if (k == 1) {
      x = read();
      fx = Get_fa(x);
      printf("%d\n", s[fx]);
    } else {
      x = read();
      y = read();
      fx = Get_fa(x);
      fy = Get_fa(y);
      if (fx != fy) {
        Union(x, y);
      }
    }
  }
  return 0;
}
