#include <bits/stdc++.h>
using namespace std;
int par[300050];
int rk[300050];
int dia[300050];
int vis[300050];
inline int find(int x) {
  if (x == par[x]) return x;
  return par[x] = find(par[x]);
}
void _merg(int x, int y) {
  int a = find(x);
  int b = find(y);
  if (a == b) return;
  if (rk[b] > rk[a]) swap(a, b);
  par[b] = a;
  rk[a] += rk[b];
}
void merg(int x, int y) {
  int a = find(x);
  int b = find(y);
  if (a == b) return;
  if (rk[b] > rk[a]) swap(a, b);
  par[b] = a;
  rk[a] += rk[b];
  int r1 = dia[a] + 1;
  int r2 = dia[b] + 1;
  r1 = r1 / 2;
  r2 = r2 / 2;
  r1 = r1 + r2 + 1;
  dia[a] = max(dia[a], r1);
  dia[a] = max(dia[a], dia[b]);
}
vector<int> gr[300050];
void init() {
  for (int i = 0; i < 300050; i++) {
    par[i] = i;
    rk[i] = 1;
    dia[i] = 0;
  }
}
int maxi, maxiV;
void dfs(int v, int d, int p) {
  if (d > maxi) {
    maxi = d;
    maxiV = v;
  }
  for (int to : gr[v]) {
    if (to != p) dfs(to, d + 1, v);
  }
}
int calcd(int v) {
  maxi = -1;
  dfs(v, 0, -1);
  maxi = -1;
  dfs(maxiV, 0, -1);
  return maxi;
}
int32_t main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  int x, y;
  init();
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y);
    gr[x].push_back(y);
    gr[y].push_back(x);
    _merg(x, y);
  }
  for (int i = 1; i <= n; i++) {
    int re = find(i);
    if (vis[re] == 0) {
      vis[re] = 1;
      dia[re] = calcd(re);
    }
  }
  int t;
  while (q--) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &x);
      printf("%d\n", dia[find(x)]);
    } else {
      scanf("%d%d", &x, &y);
      merg(x, y);
    }
  }
  return 0;
}
