#include <bits/stdc++.h>
using namespace std;
const int MAX = 3 * 1e5 + 5;
int P[MAX], D[MAX];
void Init(int n) {
  for (int i = 0; i < n; i++) P[i] = i, D[i] = 0;
}
int Find(int a) {
  if (P[a] == a) return a;
  return P[a] = Find(P[a]);
}
void Union(int a, int b) {
  int Fa = Find(a), Fb = Find(b);
  P[Fa] = Fb;
  if (Fa == Fb) return;
  int ra = (D[Fa] + 1) / 2;
  int rb = (D[Fb] + 1) / 2;
  D[Fb] = max(D[Fa], D[Fb]);
  D[Fb] = max(D[Fb], ra + rb + 1);
}
vector<int> adj[MAX];
int dist[MAX], maxi;
void bfs(int X) {
  maxi = X;
  dist[X] = 0;
  P[X] = X;
  queue<int> q;
  q.push(X);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int i = 0; i < (int)(adj[v].size()); i++) {
      int u = adj[v][i];
      if (dist[u] != -1) continue;
      q.push(u);
      P[u] = v, dist[u] = dist[v] + 1;
      if (dist[u] > dist[maxi]) maxi = u;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, q, a, b, t;
  cin >> n >> m >> q;
  Init(n);
  for (int i = 0; i < (int)(m); i++) {
    cin >> a >> b;
    a--, b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  vector<int> X;
  for (int i = 0; i < (int)(n); i++) dist[i] = -1;
  for (int i = 0; i < (int)(n); i++) {
    if (dist[i] == -1) {
      bfs(i);
      X.push_back(maxi);
    }
  }
  for (int i = 0; i < (int)(n); i++) dist[i] = -1;
  for (int i = 0; i < (int)(X.size()); i++) {
    int v = X[i];
    if (dist[v] == -1) {
      bfs(v);
      D[v] = dist[maxi];
    }
  }
  for (int v = 0; v < (int)(n); v++) {
    for (int i = 0; i < (int)(adj[v].size()); i++) {
      int u = adj[v][i];
      Union(v, u);
    }
  }
  for (int i = 0; i < (int)(q); i++) {
    cin >> t;
    if (t == 1) {
      cin >> a;
      a--;
      cout << D[Find(a)] << endl;
    } else {
      cin >> a >> b;
      a--, b--;
      Union(a, b);
    }
  }
  return 0;
}
