#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
template <typename T>
static T max(T a, T b, T c) {
  return max(a, max(b, c));
}
vector<long long int> graph[MAXN];
long long int N, M, Q;
long long int parent[MAXN], visited[MAXN], sz[MAXN], dia[MAXN];
void dfs(long long int u, long long int p, long long int &nn, long long int up,
         long long int &lo) {
  visited[u] = 1;
  if (up > lo) {
    lo = up;
    nn = u;
  }
  for (int i = 0; i < graph[u].size(); i++) {
    long long int v = graph[u][i];
    if (v != p) {
      dfs(v, u, nn, up + 1, lo);
    }
  }
}
void dfs2(long long int u, long long int p, long long int up, long long int &lo,
          long long int &nx) {
  if (up > lo) {
    nx = u;
    lo = up;
  }
  parent[u] = p;
  for (int i = 0; i < graph[u].size(); i++) {
    long long int v = graph[u][i];
    if (v != p) {
      dfs2(v, u, up + 1, lo, nx);
    }
  }
}
void dfs3(long long int u, long long int p) {
  parent[u] = p;
  for (int i = 0; i < graph[u].size(); i++) {
    long long int v = graph[u][i];
    if (v != p) dfs3(v, u), sz[u] += sz[v];
  }
}
inline long long int find_root(long long int x) {
  while (x != parent[x]) {
    parent[x] = parent[parent[x]];
    x = parent[x];
  }
  return x;
}
long long int m1, m2, m3, m4;
inline void merge(long long int a, long long int b) {
  long long int pa = find_root(a);
  long long int push_back = find_root(b);
  if (sz[pa] < sz[push_back]) swap(pa, push_back);
  if (pa != push_back) {
    parent[push_back] = parent[pa];
    sz[pa] += sz[push_back];
    dia[pa] = max(dia[pa], dia[push_back],
                  (dia[pa] + 1) / 2 + (dia[push_back] + 1) / 2 + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> M >> Q;
  for (int i = 0; i <= N; i++) {
    parent[i] = i;
    visited[i] = 0;
    sz[i] = 1;
    dia[i] = 0;
  }
  long long int x, y;
  for (int i = 1; i <= M; i++) {
    cin >> x >> y;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  for (int i = 1; i <= N; i++) {
    if (visited[i] == 0) {
      long long int nn = i, lo = 1, up = 1, nx;
      dfs(i, i, nn, up, lo);
      up = 1, lo = 1, nx = i;
      dfs2(nn, nn, up, lo, nx);
      long long int rt = nx;
      dia[rt] = lo - 1;
      dfs3(rt, rt);
    }
  }
  long long int type;
  while (Q--) {
    cin >> type;
    if (type == 1) {
      cin >> x;
      long long int root = find_root(x);
      cout << dia[root] << "\n";
    } else {
      cin >> x >> y;
      merge(x, y);
    }
  }
}
