#include <bits/stdc++.h>
using namespace std;
vector<int> a[301000];
vector<int> root;
int lv[301000], imax, savemid, savelv[301000], save;
bool check[301000];
int findd(int x) {
  if (root[x] == x || root[x] == -1) return x;
  return root[x] = findd(root[x]);
}
void dfs(int x) {
  for (int i = 0; i < a[x].size(); i++) {
    if (lv[a[x][i]] == 0) {
      lv[a[x][i]] = lv[x] + 1;
      root[a[x][i]] = findd(x);
      dfs(a[x][i]);
    }
  }
  if (imax < lv[x]) {
    imax = lv[x];
    save = x;
  }
}
void dfs2(int x) {
  check[x] = true;
  savelv[lv[x]] = x;
  for (int i = 0; i < a[x].size(); i++) {
    if (check[a[x][i]] == false) {
      lv[a[x][i]] = lv[x] + 1;
      dfs2(a[x][i]);
    }
  }
  if (imax < lv[x]) {
    imax = lv[x];
    savemid = savelv[((lv[x] + 1) / 2)];
  }
}
struct graph {
  int first, centre, maxdis, height;
  graph(int x = 1, int y = 1, int z = 0) {
    maxdis = z;
    centre = y;
    first = x;
    height = (maxdis + 1) / 2;
  }
  void build() {
    imax = 0;
    savemid = 1;
    lv[save] = 1;
    dfs2(save);
    centre = savemid;
    maxdis = imax - 1;
    height = (maxdis + 1) / 2;
  }
  graph operator+(graph a) {
    root[findd(a.first)] = findd(first);
    if (max(a.height, height) - min(a.height, height) <= 1) {
      graph ans = graph(first, centre, maxdis);
      ans.maxdis = height + a.height + 1;
      ans.height = (ans.maxdis + 1) / 2;
      if (a.height >= height)
        ans.centre = a.centre;
      else
        ans.centre = centre;
      return ans;
    } else {
      graph ans = graph(first, centre, maxdis);
      if (a.height >= height) {
        ans.centre = a.centre;
        ans.maxdis = a.maxdis;
        ans.height = a.height;
      } else {
        ans.centre = centre;
        ans.maxdis = maxdis;
        ans.height = height;
      }
      return ans;
    }
  }
  void prin() { printf("%d %d %d %d", first, maxdis, height, centre); }
} gra[301000];
int grap[301000];
int main() {
  int n, m, q, u, v, cnt = 0;
  scanf("%d %d %d", &n, &m, &q);
  root.assign(n + 1, -1);
  while (m--) {
    scanf("%d %d", &u, &v);
    a[u].push_back(v);
    a[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (findd(i) == i) {
      imax = -1;
      root[i] = i;
      lv[i] = 1;
      grap[i] = cnt + 1;
      dfs(i);
      gra[++cnt].first = i;
      gra[cnt].build();
    }
  }
  while (q--) {
    scanf("%d", &u);
    if (u == 2) {
      scanf("%d %d", &u, &v);
      if (findd(u) != findd(v)) {
        gra[grap[findd(u)]] = gra[grap[findd(u)]] + gra[grap[findd(v)]];
      }
    } else {
      scanf("%d", &u);
      printf("%d\n", gra[grap[findd(u)]].maxdis);
    }
  }
}
