#include <bits/stdc++.h>
using namespace std;
const int N = 300500;
int n;
int m;
int q;
int parent[N];
int path[N];
vector<int> graf[N];
int find(int x) { return x == parent[x] ? x : parent[x] = find(parent[x]); }
inline void load() {
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < n; i++) parent[i] = i;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    --x;
    --y;
    graf[x].push_back(y);
    graf[y].push_back(x);
    x = find(x);
    y = find(y);
    if (x != y) {
      parent[y] = x;
    }
  }
}
queue<int> Q;
int calc[N];
bool bio[N];
bool bio2[N];
inline int bfs(int x) {
  int most = -1;
  int najvece = 0;
  Q.push(x);
  Q.push(0);
  bio[x] = 1;
  while (!Q.empty()) {
    int node = Q.front();
    Q.pop();
    int distance = Q.front();
    Q.pop();
    if (distance > najvece) {
      najvece = distance;
      most = node;
    }
    for (int i = 0; i < graf[node].size(); i++) {
      int sus = graf[node][i];
      if (!bio[sus]) {
        bio[sus] = 1;
        Q.push(sus);
        Q.push(distance + 1);
      }
    }
  }
  Q.push(most);
  Q.push(0);
  int sol = 0;
  bio2[most] = 1;
  while (!Q.empty()) {
    int node = Q.front();
    Q.pop();
    int distance = Q.front();
    Q.pop();
    if (distance > sol) sol = distance;
    for (int i = 0; i < graf[node].size(); i++) {
      int sus = graf[node][i];
      if (!bio2[sus]) {
        bio2[sus] = 1;
        Q.push(sus);
        Q.push(distance + 1);
      }
    }
  }
  return sol;
}
inline void solve() {
  memset(calc, -1, sizeof(calc));
  for (int i = 0; i < n; i++) {
    if (calc[find(i)] == -1) calc[find(i)] = bfs(find(i));
  }
  for (int i = 0; i < n; i++) path[i] = calc[find(i)];
  for (; q; q--) {
    int ty, x, y;
    scanf("%d", &ty);
    if (ty == 2) {
      scanf("%d %d", &x, &y);
      --x;
      --y;
      x = find(x);
      y = find(y);
      if (x != y) {
        int a1 = path[y] / 2 + path[y] % 2;
        int a2 = path[x] / 2 + path[x] % 2;
        int izraz = a1 + a2 + 1;
        path[y] = max(path[x], path[y]);
        if (izraz > path[y]) path[y] = izraz;
        parent[x] = y;
      }
    } else {
      scanf("%d", &x);
      --x;
      x = find(x);
      printf("%d\n", path[x]);
    }
  }
}
int main(void) {
  load();
  solve();
  return 0;
}
