#include <bits/stdc++.h>
using std::max;
inline void read(int &a) {
  a = 0;
  char l = 0, c = getchar();
  while (c < '0' || c > '9') l = c, c = getchar();
  while (c >= '0' && c <= '9') a = a * 10 + c - '0', c = getchar();
  if (l == '-') a = -a;
}
inline int upper_div(int a, int b) { return a > 0 ? (a - 1) / b + 1 : a / b; }
const int MAX_N = 3e5;
int n, m, q;
struct edge {
  int v;
  edge *nx;
} egm[2 * MAX_N + 10];
edge *egmi;
struct node {
  int dis;
  edge *hd;
} nds[MAX_N + 10];
inline void make_edge(int u, int v) {
  edge *i = egmi++;
  i->v = v;
  i->nx = nds[u].hd;
  nds[u].hd = i;
}
bool b[MAX_N + 10];
int c[MAX_N + 10];
struct union_find {
  int a[MAX_N + 10];
  inline void init(int n) {
    for (int i = 1; i <= n; ++i) a[i] = i;
  }
  int find(int u) { return a[u] == u ? u : (a[u] = find(a[u])); }
  inline void union_(int u, int v) {
    u = find(u), v = find(v);
    if (rand() & 1)
      a[u] = v;
    else
      a[v] = u;
  }
  inline void union2(int u, int v) {
    u = find(u), v = find(v);
    if (u == v) return;
    if (rand() & 1) {
      c[v] = max(upper_div(c[u], 2) + upper_div(c[v], 2) + 1, max(c[u], c[v]));
      a[u] = v;
    } else {
      c[u] = max(upper_div(c[u], 2) + upper_div(c[v], 2) + 1, max(c[u], c[v]));
      a[v] = u;
    }
  }
} uf;
int dfs(int u, int p) {
  int mx = u;
  for (edge *i = nds[u].hd; i; i = i->nx) {
    if (i->v == p) continue;
    nds[i->v].dis = nds[u].dis + 1;
    int k = dfs(i->v, u);
    if (nds[k].dis > nds[mx].dis) mx = k;
  }
  return mx;
}
int main() {
  read(n), read(m), read(q);
  srand(n * 1 + m * 2 + q * 3);
  memset(nds, 0, sizeof nds);
  egmi = egm;
  uf.init(n);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    read(u), read(v);
    make_edge(u, v), make_edge(v, u);
    uf.union_(u, v);
  }
  memset(c, 0, sizeof c);
  memset(b, 0, sizeof b);
  for (int i = 1; i <= n; ++i) {
    int j = uf.find(i);
    if (b[j]) continue;
    b[j] = true;
    nds[j].dis = 0;
    int k = dfs(j, 0);
    nds[k].dis = 0;
    k = dfs(k, 0);
    c[j] = nds[k].dis;
  }
  while (q--) {
    int cmd;
    read(cmd);
    if (cmd == 1) {
      int u;
      read(u);
      u = uf.find(u);
      printf("%d\n", c[u]);
    } else {
      int u, v;
      read(u), read(v);
      uf.union2(u, v);
    }
  }
  return 0;
}
