#include <bits/stdc++.h>
using namespace std;
class UnionFind {
 private:
 public:
  vector<int> p, rank;
  UnionFind(int N) {
    rank.assign(N, 1);
    p.assign(N, 0);
    for (int i = 0; i < N; i++) p[i] = i;
  }
  void unionSet(int i, int j) {
    if (!isSameSet(i, j)) {
      int x = findSet(i), y = findSet(j);
      if (rank[x] > rank[y]) swap(x, y);
      p[x] = y;
      rank[y] += rank[x];
    }
  }
  int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
  bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
};
vector<int> v[312345];
int ans[312345];
bool f[312345];
pair<int, int> dfs(int x, int p) {
  f[x] = true;
  pair<int, int> ret = make_pair(0, x);
  if (x == p && v[x].size() == 0) return ret;
  if (x != p && v[x].size() == 1) return ret;
  int vs = v[x].size();
  for (int i = 0; i < vs; i++) {
    int y = v[x][i];
    if (y != p) {
      pair<int, int> q = dfs(y, x);
      q.first++;
      if (q.first > ret.first) ret = q;
    }
  }
  return ret;
}
int findDiameter(int x) {
  pair<int, int> p = dfs(x, x);
  pair<int, int> q = dfs(p.second, p.second);
  return q.first;
}
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  UnionFind u(n + 1);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
    u.unionSet(x, y);
  }
  for (int i = 1; i <= n; i++) {
    if (f[i] == false) {
      int r = u.findSet(i);
      int d = findDiameter(i);
      ans[r] = d;
    }
  }
  for (int i = 1; i <= q; i++) {
    int t, x, y;
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &x);
      int r = u.findSet(x);
      printf("%d\n", ans[r]);
    } else {
      scanf("%d %d", &x, &y);
      int rx = u.findSet(x);
      int ry = u.findSet(y);
      if (rx == ry) continue;
      int dx = ans[rx], dy = ans[ry];
      int c = 1 + (dx / 2 + dx % 2) + (dy / 2 + dy % 2);
      u.unionSet(x, y);
      rx = u.findSet(x);
      ans[rx] = max(c, max(dx, dy));
    }
  }
  return 0;
}
