#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const long long INF64 = 1e18;
const long double EPS = 1e-7;
mt19937 myrand(time(NULL));
const int N = 300 * 1000 + 13;
int n, m, q;
vector<int> g[N];
int p[N], d[N];
bool read() {
  if (scanf("%d%d%d", &n, &m, &q) != 3) return 0;
  for (int i = 0; i < (n); i++) g[i].clear();
  for (int i = 0; i < (n); i++) p[i] = i;
  return 1;
}
int getP(int a) { return (a == p[a] ? a : p[a] = getP(p[a])); }
void unite(int a, int b) {
  a = getP(a);
  b = getP(b);
  if (a == b) return;
  if (myrand() & 1) swap(a, b);
  p[b] = a;
  d[a] = max(max(d[b], d[a]), (d[b] + 1) / 2 + (d[a] + 1) / 2 + 1);
}
int used[N];
int cc;
char usedgl[N];
int dist[N];
int bfs(int s) {
  queue<int> q;
  q.push(s);
  ++cc;
  used[s] = cc;
  dist[s] = 0;
  int lst = -1;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    usedgl[v] = true;
    lst = v;
    for (auto u : g[v])
      if (used[u] != cc) {
        used[u] = cc;
        dist[u] = dist[v] + 1;
        q.push(u);
      }
  }
  return lst;
}
void solve() {
  for (int i = 0; i < (m); i++) {
    int f, t;
    scanf("%d%d", &f, &t);
    --f, --t;
    g[f].push_back(t);
    g[t].push_back(f);
    unite(f, t);
  }
  memset(d, 0, sizeof(d));
  memset(usedgl, false, sizeof(usedgl));
  cc = 0;
  for (int i = 0; i < (n); i++) {
    if (usedgl[i]) continue;
    int t = bfs(bfs(i));
    d[getP(i)] = dist[t];
  }
  for (int _ = 0; _ < (q); _++) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int first;
      scanf("%d", &first);
      --first;
      printf("%d\n", d[getP(first)]);
    } else {
      int first, second;
      scanf("%d%d", &first, &second);
      --first, --second;
      unite(first, second);
    }
  }
}
int main() {
  while (read()) solve();
  return 0;
}
