#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
int dia[300010];
int pa[300010];
int find(int x) {
  if (x == pa[x]) return x;
  return pa[x] = find(pa[x]);
}
int ceil(int x, int y) { return (x % y == 0) ? (x / y) : ((x / y) + 1); }
void merge(int u, int v) {
  u = find(u);
  v = find(v);
  if (u != v) {
    pa[u] = v;
    dia[v] = max(ceil(dia[v], 2) + ceil(dia[u], 2) + 1, dia[v]);
    dia[v] = max(dia[v], dia[u]);
  }
}
void add(int u, int v) {
  u = find(u);
  v = find(v);
  if (u != v) {
    pa[u] = v;
  }
}
vector<int> g[300010];
bool v[300010];
int d[300010];
void diametre(int root) {
  queue<int> q;
  q.push(root);
  vector<int> arr;
  v[root] = true;
  d[root] = 0;
  while (not q.empty()) {
    int p = q.front();
    q.pop();
    arr.push_back(p);
    for (auto i : g[p]) {
      if (v[i] == false) {
        v[i] = true;
        d[i] = 1 + d[p];
        q.push(i);
      }
    }
  }
  int maxd = 0;
  for (auto i : arr) {
    if (d[i] > maxd) {
      maxd = d[i];
      root = i;
    }
    v[i] = false;
  }
  q.push(root);
  v[root] = true;
  d[root] = 0;
  while (not q.empty()) {
    int p = q.front();
    q.pop();
    for (auto i : g[p]) {
      if (v[i] == false) {
        v[i] = true;
        d[i] = 1 + d[p];
        q.push(i);
      }
    }
  }
  for (auto i : arr) {
    maxd = max(maxd, d[i]);
  }
  for (auto i : arr) {
    dia[i] = maxd;
  }
  return;
}
int main(int argc, char const *argv[]) {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    pa[i] = i;
    dia[i] = 0;
  }
  for (int i = 1; i <= m; i++) {
    int p, q;
    scanf("%d %d", &p, &q);
    g[p].push_back(q);
    g[q].push_back(p);
    add(p, q);
  }
  for (int i = 1; i <= n; i++) {
    if (v[i] == false) {
      diametre(i);
    }
  }
  for (int i = 1; i <= q; i++) {
    int x, p, q;
    scanf("%d", &x);
    if (x == 2) {
      scanf("%d %d", &p, &q);
      merge(p, q);
    } else {
      scanf("%d", &p);
      printf("%d\n", dia[find(p)]);
    }
  }
  return 0;
}
