#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
int n, m, q, f[N], head[N], cnt, dis[N], vis[N], len[N];
struct Edge {
  int v, nx;
} e[N << 2];
vector<int> del;
inline int read() {
  int ret = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    ret = ret * 10 + (ch ^ 48);
    ch = getchar();
  }
  return ret * ff;
}
void write(int x) {
  if (x < 0) {
    x = -x, putchar('-');
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + 48);
}
void writeln(int x) { write(x), puts(""); }
void writesp(int x) { write(x), putchar(' '); }
void add(int x, int y) {
  e[++cnt].v = y;
  e[cnt].nx = head[x];
  head[x] = cnt;
}
int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }
int work(int now) {
  queue<int> q;
  q.push(now);
  vis[now] = 1;
  del.clear();
  del.push_back(now);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = head[x]; i; i = e[i].nx) {
      int v = e[i].v;
      if (vis[v]) continue;
      dis[v] = dis[x] + 1;
      vis[v] = 1;
      del.push_back(v);
      q.push(v);
    }
  }
  int mx = 0;
  for (int i = 0; i < del.size(); i++) {
    if (dis[del[i]] > dis[mx]) mx = del[i];
    vis[del[i]] = 0;
  }
  q.push(mx);
  vis[mx] = 1;
  dis[mx] = 0;
  int ans = 0;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = head[x]; i; i = e[i].nx) {
      int v = e[i].v;
      if (vis[v]) continue;
      dis[v] = dis[x] + 1;
      ans = max(ans, dis[v]);
      vis[v] = 1;
      q.push(v);
    }
  }
  return ans;
}
signed main() {
  n = read(), m = read(), q = read();
  for (int i = 1; i <= n; i++) f[i] = i;
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    add(x, y), add(y, x);
    int tx = find(x), ty = find(y);
    if (tx != ty) f[tx] = ty;
  }
  for (int i = 1; i <= n; i++)
    if (find(i) == i) len[i] = work(i);
  while (q--) {
    int opt = read();
    if (opt == 1) {
      int x = read();
      writeln(len[find(x)]);
    }
    if (opt == 2) {
      int x = read(), y = read();
      int tx = find(x), ty = find(y);
      if (tx == ty) continue;
      int A = len[tx], B = len[ty];
      f[tx] = ty;
      len[ty] = max(max(A, B), (A + 1) / 2 + (B + 1) / 2 + 1);
    }
  }
  return 0;
}
