#include <bits/stdc++.h>
using namespace std;
const int maxN = 3 * 1e5 + 5;
vector<int> roads[maxN];
int step[maxN];
int p[maxN];
unsigned long long d[maxN];
int cur_max_depth;
int far_point;
int get_set(int from) {
  if (p[from] != from) {
    return p[from] = get_set(p[from]);
  } else
    return from;
}
void dfs(int from, int depth, int st) {
  step[from] = st + 1;
  if (cur_max_depth < depth) {
    far_point = from;
    cur_max_depth = depth;
  }
  for (int i = 0; i < roads[from].size(); ++i) {
    if (step[roads[from][i]] <= st) dfs(roads[from][i], depth + 1, st);
  }
}
int main() {
  int n, m, q;
  cin >> n >> m >> q;
  for (int i = 0; i < n; ++i) {
    p[i] = i;
    d[i] = 0;
    step[i] = -1;
  }
  cur_max_depth = 0;
  far_point = 0;
  int s, a, b;
  for (int i = 0; i < m; ++i) {
    cin >> a >> b;
    a--;
    b--;
    roads[a].push_back(b);
    roads[b].push_back(a);
    p[get_set(b)] = get_set(a);
  }
  for (int i = 0; i < n; ++i) {
    if (step[i] == -1) {
      cur_max_depth = 0;
      far_point = i;
      dfs(i, 0, 0);
      dfs(far_point, 0, 1);
      d[get_set(i)] = cur_max_depth;
    }
  }
  for (int i = 0; i < q; ++i) {
    cin >> s;
    if (s == 1) {
      cin >> a;
      cout << d[get_set(a - 1)] << endl;
    } else {
      cin >> a >> b;
      a--;
      b--;
      int s1 = get_set(a);
      int s2 = get_set(b);
      if (s2 != s1) {
        unsigned long long d1 = d[s1];
        unsigned long long d2 = d[s2];
        d[s1] = max(d1, max(d2, (d1 + 1) / 2 + (d2 + 1) / 2 + 1));
        p[s2] = s1;
      }
    }
  }
  return 0;
}
