#include <bits/stdc++.h>
using namespace std;
ifstream in("input.txt");
ofstream out("output.txt");
;
long long n, m, q;
vector<long long> sz;
vector<long long> p;
vector<vector<long long> > g;
vector<long long> dias;
long long getpar(long long v) {
  if (v == p[v]) return v;
  return p[v] = getpar(p[v]);
}
void unite(long long a, long long b, bool bo = 0) {
  a = getpar(a);
  b = getpar(b);
  if (a == b) return;
  if (sz[a] < sz[b]) {
    long long t = a;
    a = b;
    b = t;
  }
  sz[a] += sz[b];
  p[b] = a;
  if (bo)
    dias[a] = max(max(dias[a], dias[b]),
                  (dias[a] + 1ll) / 2ll + (dias[b] + 1ll) / 2ll + 1ll);
}
void init() {
  ios_base::sync_with_stdio(false);
  ;
  cin >> n >> m >> q;
  g.resize(n + 1);
  dias.resize(n + 1);
  p.resize(n + 1);
  sz.resize(n + 1);
  for (long long i = 1; i <= n; i++) {
    p[i] = i;
    sz[i] = 1;
  }
  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);
    unite(a, b);
  }
}
long long maxi = -1;
long long maxv = 0;
void dfs(long long v, long long depth = 0, long long p = -1) {
  if (depth > maxi) {
    maxi = depth;
    maxv = v;
  }
  long long sz = g[v].size();
  for (long long i = 0; i < sz; i++) {
    long long to = g[v][i];
    if (to == p) continue;
    dfs(to, depth + 1, v);
  }
}
long long getDia(long long v) {
  maxi = -1;
  maxv = 0;
  dfs(v);
  maxi = -1;
  dfs(maxv);
  return maxi;
}
void precalcDias() {
  for (long long i = 1; i <= n; i++) {
    long long v = i;
    v = getpar(v);
    if (i == v) {
      dias[v] = getDia(v);
    }
  }
}
long long query1(long long x) { return dias[getpar(x)]; }
void query2(long long x, long long y) { unite(x, y, 1); }
void processQueries() {
  for (long long i = 0; i < q; i++) {
    long long type;
    cin >> type;
    if (type == 1) {
      long long x;
      cin >> x;
      cout << query1(x) << "\n";
    } else {
      long long x, y;
      cin >> x >> y;
      query2(x, y);
    }
  }
}
signed main() {
  init();
  precalcDias();
  processQueries();
  return 0;
}
