#include <bits/stdc++.h>
using namespace std;
const int MAXV = 505050;
vector<int> adj[MAXV];
int n, m, q, t, lp, c[MAXV], tc[MAXV], d[MAXV];
void dfs(int v, int color, int path) {
  c[v] = color;
  bool hasNext = false;
  for (int i = 0; i < (int)adj[v].size(); i++)
    if (c[adj[v][i]] == 0) {
      hasNext = true;
      dfs(adj[v][i], color, path + 1);
    }
  if (!hasNext) {
    if (path > lp) {
      lp = path;
      t = v;
    }
  }
}
void dfs2(int v, int path) {
  tc[v] = 1;
  bool hasNext = false;
  for (int i = 0; i < (int)adj[v].size(); i++)
    if (tc[adj[v][i]] == 0) {
      hasNext = true;
      dfs2(adj[v][i], path + 1);
    }
  if (!hasNext) {
    if (path > lp) {
      lp = path;
      t = v;
    }
  }
}
int findFa(int x) {
  if (c[x] == x) return x;
  c[x] = findFa(c[x]);
  return c[x];
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) adj[i].clear();
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  memset(d, 0, sizeof(d));
  memset(c, 0, sizeof(c));
  memset(tc, 0, sizeof(tc));
  for (int i = 1; i <= n; i++)
    if (c[i] == 0) {
      t = i;
      lp = 0;
      dfs(i, i, 0);
      lp = 0;
      dfs2(t, 0);
      d[i] = lp;
    }
  int mark, x, y, u, v, nd, tnd;
  for (int i = 0; i < q; i++) {
    scanf("%d", &mark);
    if (mark == 1) {
      scanf("%d", &x);
      printf("%d\n", d[findFa(x)]);
    } else {
      scanf("%d%d", &x, &y);
      u = findFa(x);
      v = findFa(y);
      if (u == v) continue;
      nd = max(d[u], d[v]);
      tnd = (d[u] + 1) / 2 + (d[v] + 1) / 2 + 1;
      nd = max(tnd, nd);
      c[u] = v;
      d[v] = nd;
    }
  }
  return 0;
}
