#include <bits/stdc++.h>
using namespace std;
int par[300009];
int diamt;
int minmaxx[300009];
vector<vector<int> > vec;
int findpar(int k) {
  if (par[k] == k) return k;
  int foo = findpar(par[k]);
  par[k] = foo;
  return foo;
}
void union1(int k1, int k2) {
  int foo = findpar(k1);
  int bar = findpar(k2);
  par[foo] = bar;
}
int dfs1(int k, int rt, int lvl) {
  vector<int> foo;
  int maxx = 0;
  foo.push_back(lvl);
  for (int i : vec[k]) {
    if (i != rt) {
      int bar = dfs1(i, k, lvl + 1);
      foo.push_back(bar);
      maxx = max(maxx, bar);
    }
  }
  sort(foo.rbegin(), foo.rend());
  if (vec[k].size() > 1) {
    diamt = max(diamt, foo[0] + foo[1]);
  } else {
    diamt = max(diamt, foo[0]);
  }
  return maxx + 1;
}
void union2(int k1, int k2) {
  int foo = findpar(k1);
  int bar = findpar(k2);
  if (foo != bar) {
    par[foo] = bar;
    minmaxx[bar] =
        max(max(minmaxx[bar], minmaxx[foo]),
            int(ceil(minmaxx[bar] / 2.0) + ceil(minmaxx[foo] / 2.0)) + 1);
  }
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < n; i++) par[i] = i;
  vec.resize(n + 2);
  while (m--) {
    int foo, bar;
    scanf("%d%d", &foo, &bar);
    foo--;
    bar--;
    vec[foo].push_back(bar);
    vec[bar].push_back(foo);
    union1(foo, bar);
  }
  for (int i = 0; i < n; i++) {
    if (par[i] == i) {
      diamt = 0;
      dfs1(i, -1, 0);
      minmaxx[i] = diamt;
    }
  }
  while (q--) {
    int foo;
    scanf("%d", &foo);
    if (foo == 1) {
      scanf("%d", &foo);
      foo--;
      printf("%d\n", minmaxx[findpar(foo)]);
    } else {
      int bar;
      scanf("%d%d", &foo, &bar);
      foo--;
      bar--;
      union2(foo, bar);
    }
  }
  return 0;
}
