#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long bigmod(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
const int N = 300505;
int n, m, q;
vector<int> g[N];
int vis[N], pr[N], sz[N], dia[N], maxd, maxN;
void init() {
  for (int i = int(1); i < int(N + 1); ++i)
    pr[i] = i, vis[i] = 0, sz[i] = 1, dia[i] = 0;
}
int Find(int r) {
  if (r == pr[r]) return r;
  return pr[r] = Find(pr[r]);
}
void Union(int x, int y) {
  x = Find(x);
  y = Find(y);
  if (sz[x] > sz[y]) swap(x, y);
  sz[y] += sz[x];
  pr[x] = y;
}
void dfs(int v, int d, int u) {
  if (d > maxd) {
    maxN = v;
    maxd = d;
  }
  for (size_t i = 0; i < g[v].size(); i++) {
    int it = g[v][i];
    if (it != u) {
      dfs(it, d + 1, v);
    }
  }
}
int val(int x) { return (dia[x] + 1) / 2; }
int Depth(int v) {
  maxd = -1;
  dfs(v, 0, -1);
  maxd = -1;
  dfs(maxN, 0, -1);
  return maxd;
}
void Merge(int x, int y) {
  x = Find(x);
  y = Find(y);
  if (x == y) return;
  if (sz[x] > sz[y]) swap(x, y);
  sz[y] += sz[x];
  pr[x] = y;
  dia[y] = max(val(x) + val(y) + 1, max(dia[x], dia[y]));
}
int main() {
  memset(g, 0, sizeof g);
  ;
  memset(vis, 0, sizeof vis);
  ;
  memset(pr, 0, sizeof pr);
  ;
  memset(sz, 0, sizeof sz);
  ;
  memset(dia, 0, sizeof dia);
  ;
  init();
  int t, x, y;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = int(0); i < int(m); ++i) {
    scanf("%d %d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
    Union(x, y);
  }
  for (int i = int(1); i < int(n + 1); ++i) {
    x = Find(i);
    if (!vis[x]) {
      vis[x] = 1;
      dia[x] = Depth(i);
    }
  }
  for (int i = int(0); i < int(q); ++i) {
    scanf("%d", &t);
    if (t == 2) {
      scanf("%d %d", &x, &y);
      Merge(x, y);
    } else {
      scanf("%d", &x);
      printf("%d\n", dia[Find(x)]);
    }
  }
}
