#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const int maxm = 400010;
const int INF = 0x3f3f3f3f;
const long long LINF = 3e17 + 1;
const int mod = 1e9 + 7;
int n, r, c, m;
inline int read() {
  register int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return (f == 1) ? x : -x;
}
int fa[maxn];
int getfa(int x) { return x == fa[x] ? x : fa[x] = getfa(fa[x]); }
void join(int x, int y) {
  int xx = getfa(x), yy = getfa(y);
  if (xx != yy) {
    fa[xx] = yy;
  }
}
struct edge {
  int v, nxt;
} E[maxm << 1];
int head[maxn], eid;
void add(int u, int v) {
  E[eid] = (edge){v, head[u]};
  head[u] = eid++;
}
int farnode;
int maxw;
int dist;
int d[maxn];
void dfs(int u, int f, int deep) {
  if (deep > maxw) {
    maxw = deep;
    farnode = u;
  }
  for (int v, i = head[u]; i != -1; i = E[i].nxt) {
    v = E[i].v;
    if (v == f) continue;
    dfs(v, u, deep + 1);
  }
}
int main() {
  ;
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  int k;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) fa[i] = i;
  memset(head, -1, sizeof(head));
  for (int u, v, i = 0; i < m; i++) {
    cin >> u >> v;
    add(u, v);
    add(v, u);
    join(u, v);
  }
  for (int i = 1; i <= n; i++) {
    if (getfa(i) == i) {
      farnode = i;
      maxw = 0;
      dfs(farnode, farnode, 0);
      maxw = 0;
      dfs(farnode, farnode, 0);
      d[i] = maxw;
    }
  }
  for (int u, v, op, i = 0; i < k; i++) {
    cin >> op;
    if (op == 1) {
      cin >> u;
      cout << d[getfa(u)] << endl;
    } else {
      cin >> u >> v;
      if (getfa(u) != getfa(v)) {
        d[getfa(v)] = max(max(d[getfa(u)], d[getfa(v)]),
                          (int)(ceil(1.0 * d[getfa(u)] / 2) +
                                ceil(1.0 * d[getfa(v)] / 2) + 1));
        join(u, v);
      }
    }
  }
  return 0;
}
