#include <bits/stdc++.h>
using namespace std;
int n, m, q;
int ma, ima;
vector<vector<int> > g;
vector<int> d, u;
vector<int> p, r;
int find_set(int v) {
  if (v == p[v]) return v;
  return p[v] = find_set(p[v]);
}
void union_sets(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a != b) {
    if (r[a] < r[b]) swap(a, b);
    p[b] = a;
    if (r[a] == r[b])
      ;
    ++r[a];
    int t = max((d[a] + 1) / 2 + (d[b] + 1) / 2 + 1, d[b]);
    d[a] = max(t, d[a]);
  }
}
void dfs(int v, int dist) {
  u[v] = 1;
  if (dist > ma) {
    ma = dist;
    ima = v;
  }
  for (int i = 0; i < g[v].size(); ++i)
    if (u[g[v][i]] == 0) dfs(g[v][i], dist + 1);
  u[v] = 0;
}
int diam(int v) {
  ma = 0;
  ima = v;
  dfs(v, 0);
  dfs(ima, 0);
  return ma;
}
int main() {
  ios_base::sync_with_stdio(false);
  scanf("%d %d %d", &n, &m, &q);
  g.resize(n);
  p.resize(n);
  r.assign(n, 0);
  d.assign(n, 0);
  for (int i = 0; i < n; ++i) p[i] = i;
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a;
    --b;
    union_sets(a, b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  u.assign(n, 0);
  for (int i = 0; i < n; ++i)
    if (i == find_set(i)) d[i] = diam(i);
  for (int i = 0; i < q; ++i) {
    int c;
    scanf("%d", &c);
    if (c == 1) {
      int a;
      scanf("%d", &a);
      --a;
      printf("%d\n", d[find_set(a)]);
    } else {
      int a, b;
      scanf("%d %d", &a, &b);
      --a;
      --b;
      union_sets(a, b);
    }
  }
  return 0;
}
