#include <bits/stdc++.h>
using namespace std;
vector<int> v[300005];
int ans[300005];
int arr[300005];
int size[300005];
bool visited[300005];
int max_level;
int max_v;
int root(int i) {
  while (i != arr[i]) {
    arr[i] = arr[arr[i]];
    i = arr[i];
  }
  return i;
}
int fun2(int &rootA, int &rootB) {
  if (size[rootA] > size[rootB]) swap(rootA, rootB);
}
void merge1(int x, int y) {
  int rootA = root(x);
  int rootB = root(y);
  if (rootA == rootB) return;
  fun2(rootA, rootB);
  arr[rootA] = rootB;
  size[rootB] += size[rootA];
}
void merge2(int x, int y) {
  int rootA = root(x);
  int rootB = root(y);
  if (rootA == rootB) return;
  fun2(rootA, rootB);
  arr[rootA] = rootB;
  ans[rootB] =
      max(ans[rootB], max(ans[rootA], (int)ceil(ans[rootB] / 2.0) +
                                          (int)ceil(ans[rootA] / 2.0) + 1));
  size[rootB] += size[rootA];
}
void dfs(int i, int par, int level) {
  if (level > max_level) {
    max_level = level;
    max_v = i;
  }
  for (__typeof(v[i].begin()) it = v[i].begin(); it != v[i].end(); it++) {
    if (*it != par) dfs(*it, i, level + 1);
  }
}
void ans_func(int i) {
  max_level = -1;
  dfs(i, 0, 0);
  max_level = -1;
  dfs(max_v, 0, 0);
  ans[i] = max_level;
}
int main() {
  for (int i = 0; i <= 300004; i++) {
    size[i] = 1;
    arr[i] = i;
  }
  int n, m, q;
  cin >> n >> m >> q;
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
    merge1(x, y);
  }
  for (int i = 1; i <= n; i++) {
    int rootA = root(i);
    if (!visited[rootA]) {
      ans_func(rootA);
      visited[rootA] = true;
    }
  }
  while (q--) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      int x;
      scanf("%d", &x);
      int rootA = root(x);
      cout << ans[rootA] << endl;
    } else {
      int x, y;
      scanf("%d%d", &x, &y);
      merge2(x, y);
    }
  }
}
