#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
vector<int> p, dist, diam, s, que, tmp;
vector<bool> vizited;
vector<bool> viz;
vector<int> qu, d;
int qus;
int n, m, q, l, t, qs = 0;
void Put(int x, vector<int> &Q) { Q.push_back(x); }
int Get(vector<int> &Q, int &Qs) {
  if (Q.size() <= Qs) return -1;
  return Q[Qs++];
}
void bfs(int v) {
  if (vizited[v] == true) return;
  vizited[v] = true;
  for (int i = 0; i < g[v].size(); i++) {
    if (vizited[g[v][i]] == false) {
      Put(g[v][i], que);
      dist[g[v][i]] = dist[v] + 1;
      if (dist[g[v][i]] > l) {
        l = dist[g[v][i]];
        t = g[v][i];
      }
    }
  }
}
void bfs_diam(int v) {
  if (viz[v] == true) return;
  if (p[v] != -1) s[p[v]]++;
  viz[v] = true;
  for (int i = 0; i < g[v].size(); i++) {
    if (viz[g[v][i]] == false) {
      Put(g[v][i], qu);
      p[g[v][i]] = p[v];
      if (p[v] == -1) p[g[v][i]] = v;
      d[g[v][i]] = d[v] + 1;
      if (d[g[v][i]] > l) l = d[g[v][i]];
    }
  }
}
int get_set(int v) {
  int res;
  if (p[v] == -1)
    res = v;
  else
    res = p[v] = get_set(p[v]);
  return res;
}
void union_set(int x, int y) {
  int a = get_set(x), b = get_set(y);
  if (a == b) return;
  if (s[a] > s[b]) {
    s[a] += s[b];
    s[b] = 0;
    p[b] = a;
    diam[a] =
        max(max(diam[a], diam[b]), ((diam[a] + 1) / 2 + (diam[b] + 1) / 2 + 1));
    diam[b] = 0;
  } else {
    s[b] = s[a];
    s[a] = 0;
    p[a] = b;
    diam[b] =
        max(max(diam[a], diam[b]), ((diam[a] + 1) / 2 + (diam[b] + 1) / 2 + 1));
    diam[a] = 0;
  }
}
int get_diam(int x) { return diam[get_set(x)]; }
int main(void) {
  cin >> n >> m >> q;
  p.resize(n, -1);
  g.resize(n);
  dist.resize(n, 0);
  diam.resize(n, 0);
  s.resize(n, 1);
  vizited.resize(n, false);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
  for (int i = 0; i < n; i++) {
    if (vizited[i] == false) {
      Put(i, que);
      l = 0;
      t = i;
      while (qs < que.size()) bfs(Get(que, qs));
      tmp.push_back(t);
    }
  }
  viz.resize(n, false);
  d.resize(n, 0);
  qus = 0;
  for (int i = 0; i < tmp.size(); i++) {
    if (viz[tmp[i]] == false) {
      Put(tmp[i], qu);
      l = 0;
      while (qus < qu.size()) bfs_diam(Get(qu, qus));
      diam[tmp[i]] = l;
    }
  }
  for (int i = 0; i < q; i++) {
    int a, x, y;
    cin >> a;
    if (a == 1) {
      cin >> x;
      cout << get_diam(x - 1) << "\n";
    } else if (a == 2) {
      cin >> x >> y;
      union_set(x - 1, y - 1);
    }
  }
  return 0;
}
