#include <bits/stdc++.h>
using namespace std;
int n, m, q;
vector<int> roads[300001];
bool is_in[300001];
int tags[300001];
int dists[300001];
vector<int> tagged[300001];
pair<int, int> tag(int t, int n) {
  tags[n] = t;
  tagged[t].push_back(n);
  is_in[n] = true;
  int max1 = 0;
  vector<int> vs;
  for (auto m : roads[n]) {
    if (is_in[m]) continue;
    pair<int, int> p = tag(t, m);
    max1 = max(max1, p.first);
    vs.push_back(p.second);
  }
  int max2 = 0;
  sort(vs.begin(), vs.end(), greater<int>());
  if (vs.size()) {
    max2 = 1 + vs[0];
    max1 = max(max1, max2);
  }
  if (vs.size() > 1) {
    max1 = max(max1, max2 + 1 + vs[1]);
  }
  return make_pair(max1, max2);
}
int main(int argc, char* argv[]) {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    roads[a].push_back(b);
    roads[b].push_back(a);
  }
  for (int i = 0; i <= 300000; ++i) {
    is_in[i] = false;
    dists[i] = 0;
  }
  for (int i = 0; i <= 300000; ++i)
    if (not is_in[i]) dists[i] = tag(i, i).first;
  for (int i = 0; i < q; ++i) {
    int req;
    scanf("%d", &req);
    if (1 == req) {
      int x;
      scanf("%d", &x);
      printf("%d\n", dists[tags[x]]);
    } else if (2 == req) {
      int x, y;
      scanf("%d %d", &x, &y);
      int tag_x = tags[x], tag_y = tags[y];
      if (tag_x == tag_y) continue;
      int d = max(dists[tag_x], dists[tag_y]);
      d = max(d, 1 + (dists[tag_x] + 1) / 2 + (dists[tag_y] + 1) / 2);
      if (tagged[tag_x].size() < tagged[tag_y].size()) {
        for (int n : tagged[tag_x]) {
          tagged[tag_y].push_back(n);
          tags[n] = tag_y;
        }
        tagged[tag_x].clear();
        dists[tag_y] = d;
      } else {
        for (int n : tagged[tag_y]) {
          tagged[tag_x].push_back(n);
          tags[n] = tag_x;
        }
        tagged[tag_y].clear();
        dists[tag_x] = d;
      }
    }
  }
  return 0;
}
