#include <bits/stdc++.h>
using namespace std;
long long power(long long b, long long e, long long m) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b % m, e / 2, m) % m;
  return power(b * b % m, e / 2, m);
}
long long power(long long b, long long e) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b, e / 2);
  return power(b * b, e / 2);
}
const int N = 300002;
vector<int> v[N];
bool vis[N];
int p[N], r[N], ans[N], dep[N], init;
vector<int> check;
void in(int n) {
  for (int i = 1; i <= n; ++i) {
    r[i] = 0;
    p[i] = i;
    ans[i] = 0;
  }
}
int parent(int i) {
  if (i == p[i]) return i;
  return p[i] = parent(p[i]);
}
void merge(int x, int y) {
  x = parent(x);
  y = parent(y);
  if (x == y) return;
  int zz = max({ans[x], ans[y], (ans[x] + 1) / 2 + (ans[y] + 1) / 2 + 1});
  if (r[x] > r[y]) {
    p[y] = x;
    ans[x] = zz;
  } else {
    p[x] = y;
    ans[y] = zz;
  }
  if (r[x] == r[y]) ++r[y];
}
void dfs(int s, int &md, int &val, int para) {
  vis[s] = true;
  for (auto j : v[s]) {
    if (!vis[j]) {
      check.push_back(j);
      dep[j] = dep[s] + 1;
      p[j] = init;
      if (dep[j] > md) {
        md = dep[j];
        val = j;
      }
      dfs(j, md, val, para);
      dep[j] = 0;
    }
  }
  if (para == 1) vis[s] = false;
}
int findDiameter(int s) {
  dep[s] = 0;
  int ans1 = 0;
  int md = 0, val = s, para;
  dfs(s, md, val, para = 1);
  dep[val] = 0;
  md = 0;
  dfs(val, md, s, para = 0);
  return md;
}
int _runtimeTerror_() {
  int n, m, q;
  cin >> n >> m >> q;
  in(n);
  while (m--) {
    int xx, yy;
    cin >> xx >> yy;
    v[xx].push_back(yy);
    v[yy].push_back(xx);
  }
  for (int i = 1; i <= n; ++i) {
    if (!vis[i]) {
      check.clear();
      init = i;
      ans[i] = findDiameter(i);
    }
  }
  while (q--) {
    int tt, xx, yy;
    cin >> tt >> xx;
    if (tt == 1) {
      cout << ans[parent(xx)] << "\n";
    } else {
      cin >> yy;
      merge(xx, yy);
    }
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) _runtimeTerror_();
  return 0;
}
