#include <bits/stdc++.h>
using namespace std;
vector<int> dist;
vector<int> a;
vector<int> rang;
vector<int> matr[300000];
vector<int> flag;
int maxi, maxdist;
int find(int x) {
  int d, y;
  d = x;
  while (a[d] != d) d = a[d];
  while (a[x] != x) {
    y = x;
    x = a[x];
    a[y] = d;
  }
  return d;
}
void dfs1(int x, int dist) {
  int i, l;
  flag[x] = 1;
  if (dist > maxdist) {
    maxdist = dist;
    maxi = x;
  }
  for (i = 0; i < matr[x].size(); i++) {
    if (flag[matr[x][i]] == 0) dfs1(matr[x][i], dist + 1);
  }
  return;
}
void dfs2(int x, int dist) {
  int i, l;
  flag[x] = 2;
  if (dist > maxdist) {
    maxdist = dist;
    maxi = x;
  }
  for (i = 0; i < matr[x].size(); i++) {
    if (flag[matr[x][i]] == 1) dfs2(matr[x][i], dist + 1);
  }
  return;
}
void sunion(int x, int y) {
  int d1, d2;
  d1 = find(x);
  d2 = find(y);
  if (d1 != d2) {
    if (rang[d1] == rang[d2]) {
      a[d1] = d2;
      rang[d2]++;
      dist[d2] = max(max(dist[d1], dist[d2]),
                     (dist[d1] + 1) / 2 + (dist[d2] + 1) / 2 + 1);
    } else if (rang[x] > rang[y]) {
      a[d2] = d1;
      dist[d1] = max(max(dist[d1], dist[d2]),
                     (dist[d1] + 1) / 2 + (dist[d2] + 1) / 2 + 1);
    } else {
      a[d1] = d2;
      dist[d2] = max(max(dist[d1], dist[d2]),
                     (dist[d1] + 1) / 2 + (dist[d2] + 1) / 2 + 1);
    }
  }
  return;
}
int main() {
  int n, m, q, i, x, y, z, j, b;
  cin >> n >> m >> q;
  for (i = 0; i < n; i++) {
    a.push_back(i);
    rang.push_back(0);
    dist.push_back(0);
  }
  for (i = 0; i < n; i++) {
    flag.push_back(0);
  }
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    sunion(x - 1, y - 1);
    matr[x - 1].push_back(y - 1);
    matr[y - 1].push_back(x - 1);
  }
  for (i = 0; i < n; i++) {
    if (flag[i] == 0) {
      maxi = i;
      maxdist = 0;
      dfs1(i, 0);
      maxdist = 0;
      dfs2(maxi, 0);
      dist[find(i)] = maxdist;
    }
  }
  for (i = 0; i < q; i++) {
    cin >> x;
    if (x == 1) {
      cin >> y;
      printf("%d\n", dist[find(y - 1)]);
    } else {
      scanf("%d %d", &y, &z);
      sunion(y - 1, z - 1);
    }
  }
  return 0;
}
