#include <bits/stdc++.h>
using namespace std;
const int N = 333333;
vector<int> g[N];
int pr[N];
int v1[N];
int v2[N];
int was[N];
int fs(int x) {
  if (pr[x] != x) pr[x] = fs(pr[x]);
  return pr[x];
}
void un(int x, int y) {
  x = fs(x);
  y = fs(y);
  if (x == y) return;
  if (rand() & 1) {
    pr[x] = y;
  } else {
    pr[y] = x;
  }
}
int D[N];
int farest(int x, int it) {
  int last = 0;
  queue<int> q;
  q.push(x);
  was[x] = it;
  D[x] = 0;
  while (!q.empty()) {
    int t = q.front();
    q.pop();
    last = t;
    for (size_t i = 0; i < g[t].size(); ++i) {
      int y = g[t][i];
      if (was[y] != it) {
        was[y] = it;
        D[y] = D[t] + 1;
        q.push(y);
      }
    }
  }
  return last;
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; ++i) {
    pr[i] = i;
  }
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
    un(x, y);
  }
  for (int i = 1; i <= n; ++i)
    if (!was[i]) {
      int x = fs(i);
      int y = farest(x, 1);
      int z = farest(y, 2);
      v1[x] = (D[z] + 1) / 2;
      v2[x] = D[z] / 2;
    }
  for (int i = 0; i < q; ++i) {
    int t;
    scanf("%d", &t);
    if (t == 1) {
      int x;
      scanf("%d", &x);
      x = fs(x);
      printf("%d\n", v1[x] + v2[x]);
    } else {
      int y, x;
      scanf("%d%d", &x, &y);
      x = fs(x);
      y = fs(y);
      if (x == y) continue;
      int d = max(v1[x] + v2[x], max(v1[y] + v2[y], v1[x] + 1 + v1[y]));
      un(x, y);
      x = fs(x);
      v1[x] = (d + 1) / 2;
      v2[x] = d / 2;
    }
  }
  return 0;
}
