#include <bits/stdc++.h>
using namespace std;
void MP() {
  ios::sync_with_stdio(false);
  cin.tie(0);
}
const long long MAX = (long long)3e5 + 15;
const long long MAX2 = 25;
const long long inf = (long long)2e17 + 9;
const long double EPS = 1e-5;
const long long sigma = 128;
const long long delta = (long long)1e6 + 3;
const long long MAXB = (1 * 20);
inline bool gt(long long a, long long i) { return (a >> i) & 1; }
const long long MOD = (long long)1e9 + 7;
const long long P = (long long)1e9;
mt19937_64 rnd(time(0));
long long p[MAX], len[MAX], f[MAX];
void __init(long long a) {
  p[a] = a;
  f[a] = len[a] = 1;
}
long long find_set(long long a) {
  return p[a] == a ? a : p[a] = find_set(p[a]);
}
bool OK = false;
void union_set(long long a, long long b) {
  a = find_set(a);
  b = find_set(b);
  if (a == b) return;
  p[b] = a;
  len[a] += len[b];
  if (OK) f[a] = max({(f[a] + 1) / 2 + (f[b] + 1) / 2 + 1, f[a], f[b]});
}
vector<long long> g[MAX];
long long cnt[MAX];
long long tmr = 0;
long long find_diametr(long long a) {
  a = find_set(a);
  queue<long long> q;
  q.push(a);
  ++tmr;
  long long lv;
  while (!q.empty()) {
    long long v = q.front();
    q.pop();
    cnt[v] = tmr;
    lv = v;
    for (long long to : g[v]) {
      if (cnt[to] != tmr) {
        q.push(to);
      }
    }
  }
  queue<pair<long long, long long> > qs;
  qs.push({lv, 0});
  lv = 0;
  ++tmr;
  while (!qs.empty()) {
    long long v = qs.front().first;
    lv = qs.front().second + 1;
    qs.pop();
    cnt[v] = tmr;
    for (long long to : g[v]) {
      if (cnt[to] != tmr) {
        qs.push({to, lv});
      }
    }
  }
  return lv;
}
void solve() {
  long long n, m, q;
  cin >> n >> m >> q;
  for (long long i = 0; i < n; ++i) __init(i);
  for (long long i = 0; i < m; ++i) {
    long long a, b;
    cin >> a >> b;
    g[--a].push_back(--b);
    g[b].push_back(a);
    union_set(a, b);
  }
  for (long long i = 0; i < n; ++i) {
    if (!cnt[i]) {
      f[find_set(i)] = find_diametr(i) - 1;
    }
  }
  OK = true;
  while (q--) {
    long long t;
    cin >> t;
    if (t == 1) {
      long long x;
      cin >> x;
      cout << (f[find_set(--x)]) << '\n';
    } else {
      long long a, b;
      cin >> a >> b;
      union_set(--a, --b);
    }
  }
}
signed main() {
  MP();
  solve();
}
