#include <bits/stdc++.h>
using namespace std;
string i_s(int x) {
  if (x == 0) return "0";
  string ret = "";
  while (x) {
    ret = ret + (char)(x % 10 + '0');
    x /= 10;
  }
  reverse(ret.begin(), ret.end());
  return ret;
}
string add(string a, string b) {
  if (a == "") a = "0";
  if (b == "") b = "0";
  if (a.length() < b.length()) swap(a, b);
  while (b.length() < a.length()) {
    b = '0' + b;
  }
  for (int i = 0; i < a.length(); i++) {
    a[i] = a[i] + (b[i] - '0');
  }
  bool big = false;
  for (int i = a.length() - 1; i >= 0; i--) {
    if (big) {
      a[i]++;
    }
    big = false;
    if (a[i] > '9') {
      a[i] = a[i] - 10;
      big = true;
    }
  }
  if (big) a = '1' + a;
  return a;
}
string mul(string a, string b) {
  vector<int> va, vb;
  if (a == "0" || b == "0") return "0";
  string ans;
  for (int i = 0; i < a.length(); i++) {
    va.push_back(a[i] - '0');
  }
  for (int i = 0; i < b.length(); i++) {
    vb.push_back(b[i] - '0');
  }
  reverse(va.begin(), va.end());
  reverse(vb.begin(), vb.end());
  vector<int> res;
  res.clear();
  res.resize(1005);
  for (int i = 0; i < a.length(); i++) {
    for (int j = 0; j < b.length(); j++) {
      res[i + j] += (va[i] * vb[j]);
    }
  }
  for (int i = 0; i < 1005; i++) {
    if (res[i] > 9) {
      res[i + 1] += (res[i] / 10);
      res[i] %= 10;
    }
  }
  for (int i = 0; i < 1005; i++) {
    ans += (res[i] + '0');
  }
  reverse(ans.begin(), ans.end());
  int k = 0;
  while (ans[k] == '0') {
    k++;
  }
  ans = ans.substr(k);
  return ans;
}
bool is_prime(int n) {
  if (n < 2) return false;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
int i, j, k, n, m, root[300005], x, lp[300005], y, q, t1, t2, h[300005], mx,
    mxnode;
vector<int> v[300005];
void dfs(int x, int s, int t) {
  if (s > mx) {
    mx = s;
    mxnode = x;
  }
  h[x] = t;
  root[x] = i;
  for (int j = 0; j < v[x].size(); j++) {
    if (h[v[x][j]] != t) {
      h[v[x][j]] = t;
      dfs(v[x][j], s + 1, t);
    }
  }
}
int dsu(int x) {
  if (root[x] == x) return x;
  return root[x] = dsu(root[x]);
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (i = 0; i < m; i++) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (i = 1; i <= n; i++) {
    if (root[i]) continue;
    mx = -1;
    dfs(i, 0, 1);
    mx = -1;
    dfs(mxnode, 0, 2);
    lp[i] = mx;
  }
  for (i = 0; i < k; i++) {
    scanf("%d %d", &q, &x);
    if (q == 1) {
      printf("%d\n", lp[dsu(x)]);
      continue;
    }
    scanf("%d", &y);
    t1 = dsu(x);
    t2 = dsu(y);
    if (t1 == t2) continue;
    lp[t1] = max(max(lp[t1], lp[t2]), (lp[t1] + 1) / 2 + (lp[t2] + 1) / 2 + 1);
    root[t2] = t1;
  }
  return 0;
}
