#include <bits/stdc++.h>
using namespace std;
int N, M, Q;
struct node {
  vector<node*> edges;
  node* rep;
  int diam;
  bool visit[2];
  int dist;
  int id;
  node() : diam(-1), rep(NULL) { visit[0] = visit[1] = false; }
} nodes[300001];
vector<int> V;
int bfs(int idx, int t) {
  nodes[idx].visit[t] = true;
  nodes[idx].dist = 0;
  queue<int> Q;
  Q.push(idx);
  int last;
  while (!Q.empty()) {
    int v = last = Q.front();
    if (t == 1) V.push_back(v);
    Q.pop();
    for (node* n : nodes[v].edges) {
      if (!n->visit[t]) {
        n->dist = nodes[v].dist + 1;
        n->visit[t] = true;
        Q.push(n->id);
      }
    }
  }
  return last;
}
void do_thingy(int idx) {
  V.clear();
  idx = bfs(idx, 0);
  idx = bfs(idx, 1);
  for (int n : V) {
    nodes[n].rep = nodes + idx;
  }
  nodes[idx].rep = NULL;
  nodes[idx].diam = nodes[idx].dist;
}
node* par(node* n) {
  node* o = n;
  while (n->rep != NULL) {
    n = n->rep;
  }
  while (o->rep != NULL) {
    node* next = o->rep;
    o->rep = n;
    o = next;
  }
  return n;
}
int main() {
  int N, M, Q;
  scanf("%d", &(N)), scanf("%d", &(M)), scanf("%d", &(Q));
  for (int i = (0); i < (N); i++) nodes[i].id = i;
  for (int COUNTER = (0); COUNTER < (M); COUNTER++) {
    int a, b;
    scanf("%d", &(a)), scanf("%d", &(b));
    a--, b--;
    nodes[a].edges.push_back(nodes + b);
    nodes[b].edges.push_back(nodes + a);
  }
  for (int i = (0); i < (N); i++)
    if (!nodes[i].visit[0]) {
      do_thingy(i);
    }
  for (int COUNTER = (0); COUNTER < (Q); COUNTER++) {
    int t, a, b;
    scanf("%d", &(t)), scanf("%d", &(a));
    if (t == 2) {
      scanf("%d", &(b));
      b--;
    }
    a--;
    if (t == 2) {
      node* n1 = par(nodes + a);
      node* n2 = par(nodes + b);
      if (n1 == n2) continue;
      n1->diam = max(max(n1->diam, n2->diam),
                     (((n1->diam) + 1) / 2) + (((n2->diam) + 1) / 2) + 1);
      n2->rep = n1;
    } else {
      printf("%d\n", par(nodes + a)->diam);
    }
  }
}
