#include <bits/stdc++.h>
using namespace std;
int n, m, q, tata[300000 + 10], rang[300000 + 10], dist[300000 + 10];
bool viz[300000 + 10];
vector<int> nod[300000 + 10], v;
queue<int> Q;
int findDaddy(int x) {
  int y = x, r = x;
  while (r != tata[r]) r = tata[r];
  while (x != tata[x]) {
    x = tata[x];
    tata[y] = r;
    y = x;
  }
  return r;
}
void unite(int x, int y) { tata[y] = x; }
void calcDiametru(int x) {
  viz[x] = 1;
  v.clear();
  v.push_back(x);
  Q.push(x);
  dist[x] = 0;
  while (!Q.empty()) {
    int a = Q.front();
    Q.pop();
    for (int i = 0; i < nod[a].size(); i++)
      if (!viz[nod[a][i]]) {
        viz[nod[a][i]] = 1;
        dist[nod[a][i]] = dist[a] + 1;
        Q.push(nod[a][i]);
        v.push_back(nod[a][i]);
      }
  }
  int maxi = 0, p = 0;
  for (int i = 0; i < v.size(); i++) {
    int x = v[i];
    if (dist[x] > maxi) maxi = dist[x], p = x;
    dist[x] = viz[x] = 0;
  }
  viz[p] = 1;
  v.clear();
  v.push_back(p);
  dist[p] = 0;
  Q.push(p);
  while (!Q.empty()) {
    int a = Q.front();
    Q.pop();
    for (int i = 0; i < nod[a].size(); i++)
      if (!viz[nod[a][i]]) {
        viz[nod[a][i]] = 1;
        dist[nod[a][i]] = dist[a] + 1;
        Q.push(nod[a][i]);
        v.push_back(nod[a][i]);
      }
  }
  maxi = 0;
  for (int i = 0; i < v.size(); i++) {
    int a = v[i];
    maxi = max(maxi, dist[a]);
    if (a != x) unite(x, a);
  }
  rang[x] = maxi;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= n; i++) tata[i] = i, rang[i] = 0;
  for (int i = 1; i <= m; i++) {
    int nod1, nod2;
    cin >> nod1 >> nod2;
    nod[nod1].push_back(nod2);
    nod[nod2].push_back(nod1);
  }
  for (int i = 1; i <= n; i++)
    if (!viz[i]) calcDiametru(i);
  while (q--) {
    int type;
    cin >> type;
    if (type == 1) {
      int x, y;
      cin >> x;
      y = findDaddy(x);
      cout << rang[y] << '\n';
    } else {
      int x, y;
      cin >> x >> y;
      int a = findDaddy(x), b = findDaddy(y);
      if (a == b) continue;
      if (rang[a] < rang[b]) swap(a, b);
      rang[a] = max(rang[a], (rang[a] + 1) / 2 + (rang[b] + 1) / 2 + 1);
      unite(a, b);
    }
  }
  return 0;
}
