#include <bits/stdc++.h>
using namespace std;
class edge {
 public:
  int fr, to, next;
} all[612345];
int iEnd;
int iHead[312345];
void add(int fr, int to) {
  all[iEnd].fr = fr;
  all[iEnd].to = to;
  all[iEnd].next = iHead[fr];
  iHead[fr] = iEnd++;
  all[iEnd].fr = to;
  all[iEnd].to = fr;
  all[iEnd].next = iHead[to];
  iHead[to] = iEnd++;
}
int val[312345];
int belongto[312345];
int find(int need) {
  return belongto[need] == need ? need : belongto[need] = find(belongto[need]);
}
void combine(int fth, int son) {
  int f(find(fth)), s(find(son));
  if (f != s) {
    belongto[s] = f;
  }
}
int mark[2][312345];
queue<int> que;
void find_diameter(int pt) {
  que.push(pt);
  mark[0][pt] = 1;
  int point(pt), len(0);
  while (!que.empty()) {
    int length = que.size();
    for (int i(0); i != length; ++i) {
      int now(que.front());
      que.pop();
      point = now;
      for (int i(iHead[now]); i != -1; i = all[i].next) {
        if (!mark[0][all[i].to]) {
          que.push(all[i].to);
          mark[0][all[i].to] = 1;
        }
      }
    }
    ++len;
  }
  que.push(point);
  mark[1][point] = 1;
  len = 0;
  while (!que.empty()) {
    int length = que.size();
    for (int i(0); i != length; ++i) {
      int now(que.front());
      que.pop();
      point = now;
      for (int i(iHead[now]); i != -1; i = all[i].next) {
        if (!mark[1][all[i].to]) {
          que.push(all[i].to);
          mark[1][all[i].to] = 1;
        }
      }
    }
    ++len;
  }
  val[find(pt)] = len;
}
int n, m, q;
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i(1); i <= n; ++i) {
    iHead[i] = -1;
    belongto[i] = i;
  }
  for (int i(0); i != m; ++i) {
    int fr, to;
    scanf("%d%d", &fr, &to);
    if (fr == to) continue;
    add(fr, to);
    combine(fr, to);
  }
  for (int i(1); i <= n; ++i) {
    if (!mark[0][i]) {
      find_diameter(i);
    }
  }
  for (int i(0); i != q; ++i) {
    int cmd;
    scanf("%d", &cmd);
    if (cmd == 1) {
      int pt;
      scanf("%d", &pt);
      printf("%d\n", val[find(pt)] - 1);
    } else {
      int fr, to;
      scanf("%d%d", &fr, &to);
      int ffth(find(fr)), fth(find(to));
      if (find(fr) == find(to)) continue;
      int len1(val[ffth]), len2(val[fth]);
      combine(fr, to);
      ffth = find(fr);
      val[ffth] = (len1 >> 1) + (len2 >> 1) + 2;
      val[ffth] = ((val[ffth]) > (len1) ? (val[ffth]) : (len1));
      val[ffth] = ((val[ffth]) > (len2) ? (val[ffth]) : (len2));
    }
  }
  return 0;
}
