#include <bits/stdc++.h>
using namespace std;
template <typename T>
void chkmax(T &x, T y) {
  x = x > y ? x : y;
}
template <typename T>
void chkmin(T &x, T y) {
  x = x > y ? y : x;
}
template <typename T>
void upd(T &x, T y, T mod) {
  x = x + y > mod ? x + y - mod : x + y;
}
template <typename T>
void sub(T &x, T y, T mod) {
  x = x - y < 0 ? x - y + mod : x - y;
}
template <typename T>
void multi(T &x, T y, T mod) {
  x = 1ll * x * y % mod;
}
const int INF = (1ll << 30);
template <typename T>
void read(T &x) {
  x = 0;
  bool f = 1;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = 0;
  } while (ch > '9' || ch < '0');
  do {
    x = x * 10 + ch - '0';
    ch = getchar();
  } while (ch >= '0' && ch <= '9');
  x = f ? x : -x;
}
template <typename T>
void write(T x) {
  if (x < 0) x = ~x + 1, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int N = 3e5 + 7;
struct EDGE {
  int to, nxt;
} edge[N << 1];
int n, m, q, E, dp[N], fa[N], ans[N], head[N];
bool vis[N];
inline void addedge(int u, int v) {
  edge[++E].to = v;
  edge[E].nxt = head[u];
  head[u] = E;
}
inline int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }
inline bool merge(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return false;
  fa[x] = y;
  return true;
}
inline void dfs(int u, int fa, int rt) {
  for (int i = head[u]; i; i = edge[i].nxt) {
    int v = edge[i].to;
    if (v == fa) continue;
    dfs(v, u, rt);
    chkmax(ans[rt], dp[v] + dp[u] + 1);
    chkmax(dp[u], dp[v] + 1);
  }
}
int main() {
  read(n);
  read(m);
  read(q);
  for (int i = 1; i <= n; i++) fa[i] = i;
  for (int i = 1, u, v; i <= m; i++) {
    read(u);
    read(v);
    addedge(u, v);
    addedge(v, u);
    merge(u, v);
  }
  for (int i = 1; i <= n; i++)
    if (fa[i] == i) dfs(i, 0, i);
  for (int i = 1, opt, x, y; i <= q; i++) {
    read(opt);
    if (opt == 1) {
      read(x);
      printf("%d\n", ans[find(x)]);
    } else {
      read(x);
      read(y);
      int xx = find(x), yy = find(y);
      if (xx == yy) continue;
      merge(x, y);
      ans[find(x)] =
          max((ans[xx] + 1) / 2 + (ans[yy] + 1) / 2 + 1, max(ans[xx], ans[yy]));
    }
  }
  return 0;
}
