#include <bits/stdc++.h>
using namespace std;
bool deb = false;
const int N = 300011;
vector<int> gr[N];
int vs[N];
int dp[N], diameter;
int par[N], rnk[N], dia[N];
void init(int n) {
  int i;
  for (i = 0; i <= n + 1; i++) par[i] = i, rnk[i] = 1, dia[i] = 0;
}
int root(int v) { return (par[v] == v) ? v : (par[v] = root(par[v])); }
bool check(int u, int v) { return root(u) == root(v); }
void join(int u, int v) {
  int pu = u, pv = v;
  pu = root(u);
  pv = root(v);
  if (pv != pu) {
    if (rnk[pu] < rnk[pv]) {
      swap(pu, pv);
    }
    rnk[pu] += rnk[pv];
    par[pv] = pu;
    dia[pu] =
        max(dia[pv], max(dia[pu], (dia[pu] + 1) / 2 + 1 + (dia[pv] + 1) / 2));
  }
}
int cmpsz = 0;
void dfs_dia(int v, int p) {
  int i, mx1 = 0, mx2 = 0;
  vs[v] = 1;
  cmpsz++;
  for (i = 0; i < gr[v].size(); i++) {
    int u = gr[v][i];
    join(u, v);
    if (gr[v][i] != p) {
      dfs_dia(gr[v][i], v);
      if (dp[u] + 1 > mx1) {
        mx2 = mx1;
        mx1 = dp[u] + 1;
      } else if (dp[u] + 1 > mx2) {
        mx2 = dp[u] + 1;
      }
    }
  }
  diameter = max(diameter, mx1 + mx2);
  dp[v] = max(mx1, mx2);
}
void diam(int v) {
  diameter = 0;
  dfs_dia(v, 0);
  int p = root(v);
  dia[p] = max(dia[p], diameter);
  rnk[p] = cmpsz;
}
int main() {
  int i, j, n, m, q;
  scanf("%d", &n), scanf("%d", &m), scanf("%d", &q);
  init(n);
  for (i = 0; i < m; ++i) {
    int u, v;
    scanf("%d", &u), scanf("%d", &v);
    gr[u].push_back(v);
    gr[v].push_back(u);
  }
  for (i = 1; i < n + 1; ++i) {
    if (vs[i] == 0) diam(i);
  }
  while (q--) {
    int t, u, v;
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d", &u);
      int p = root(u);
      printf("%d\n", dia[p]);
    } else {
      scanf("%d", &u), scanf("%d", &v);
      join(u, v);
    }
  }
  return 0;
}
