#include <bits/stdc++.h>
#pragma comment(linker, "/stack:256000000")
using namespace std;
const int N = 300100;
vector<int> g[N];
int pr[N];
bool u[N];
vector<int> path[N];
int get(int v) {
  if (pr[v] == v) return v;
  return pr[v] = get(pr[v]);
}
int un(int a, int b) {
  a = get(a);
  b = get(b);
  if (a != b) {
    if (rand() & 1) {
      pr[a] = b;
      return b;
    } else {
      pr[b] = a;
      return a;
    }
  } else {
    return -1;
  }
}
bool used[N];
int prv[N];
vector<int> bfs(int v) {
  used[v] = 1;
  queue<int> Q;
  Q.push(v);
  int x = -1;
  vector<int> vis;
  while (!Q.empty()) {
    x = Q.front();
    Q.pop();
    vis.push_back(x);
    for (int(i) = 0; (i) < ((int)(g[x]).size()); (i)++) {
      int to = g[x][i];
      if (!used[to]) {
        used[to] = 1;
        prv[to] = x;
        Q.push(to);
      }
    }
  }
  vector<int> path;
  while (x != -1) {
    path.push_back(x);
    x = prv[x];
  }
  reverse((path).begin(), (path).end());
  for (int(i) = 0; (i) < ((int)(vis).size()); (i)++) {
    used[vis[i]] = 0;
    prv[vis[i]] = -1;
  }
  return path;
}
int main() {
  int n, m, q, t, a, b;
  cin >> n >> m >> q;
  for (int(i) = 0; (i) < (n); (i)++) {
    pr[i] = i;
  }
  for (int(i) = 0; (i) < (m); (i)++) {
    scanf("%d%d", &a, &b);
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
    un(a, b);
  }
  for (int(i) = 0; (i) < (n); (i)++) {
    u[get(i)] = 1;
  }
  vector<int> temp;
  memset(used, 0, sizeof(used));
  memset(prv, -1, sizeof(prv));
  for (int(i) = 0; (i) < (n); (i)++) {
    if (u[i]) {
      temp = bfs(i);
      path[i] = bfs(temp.back());
    }
  }
  for (int(i) = 0; (i) < (q); (i)++) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &a);
      --a;
      int aa = get(a);
      printf("%d\n", (int)(path[aa]).size() - 1);
    } else {
      scanf("%d%d", &a, &b);
      --a, --b;
      int aa = get(a);
      int bb = get(b);
      int c = un(a, b);
      if (c != -1) {
        temp.clear();
        int nn = (int)(path[aa]).size() / 2 + 1;
        int mm = (int)(path[bb]).size() / 2 + 1;
        if ((int)(path[aa]).size() >= nn + mm &&
            (int)(path[aa]).size() >= (int)(path[bb]).size()) {
          temp = path[aa];
        } else if ((int)(path[bb]).size() >= nn + mm &&
                   (int)(path[bb]).size() >= (int)(path[aa]).size()) {
          temp = path[bb];
        } else {
          for (int(i) = 0; (i) < (nn); (i)++) {
            temp.push_back(path[aa][i]);
          }
          for (int(i) = 0; (i) < (mm); (i)++) {
            temp.push_back(path[bb][i]);
          }
        }
        path[aa].clear();
        path[bb].clear();
        path[c].clear();
        path[c] = temp;
      }
    }
  }
  return 0;
}
