#include <bits/stdc++.h>
using namespace std;
int bigmod(int b, int p, int m) {
  int res = 1, x = b;
  while (p) {
    if (p & 1) res = (res * x) % m;
    x = (x * x) % m;
    p >>= 1;
  }
  return res;
}
int ex_euc(int aa, int bb, int *xx, int *yy) {
  int x, y, u, v, m, n, a, b, q, r;
  x = 0, y = 1;
  u = 1, v = 0;
  for (a = aa, b = bb; a != 0; b = a, a = r, x = u, y = v, u = m, v = n) {
    q = b / a;
    r = b % a;
    m = x - (u * q);
    n = y - (v * q);
  }
  *xx = x;
  *yy = y;
  return b;
}
int gcd(int a, int b) {
  int c;
  while (b) {
    c = a % b;
    a = b;
    b = c;
  }
  return a;
}
int lcm(int a, int b) { return (int)(a * (b / gcd(a, b))); }
int Pow(int a, int p) {
  int res = 1, x = a;
  while (p) {
    if (p & 1) res = res * x;
    x = x * x;
    p >>= 1;
  }
  return res;
}
int Max(int a, int b) { return a > b ? a : b; }
int Min(int a, int b) { return a < b ? a : b; }
int Abs(int a) { return a < 0 ? -a : a; }
vector<int> E[500005];
int sm, node, dia, vis[500005], L[500005], par[500005], Id[500005];
int dfs(int u, int c) {
  vis[u] = sm;
  int i, j = E[u].size() - 1, v, w, d = c;
  if (dia < c) dia = c, node = u;
  for (i = 0; i <= j; i++) {
    v = E[u][i];
    if (vis[v] != sm) {
      w = dfs(v, c + 1);
      if (d < w) d = w;
    }
  }
  return d;
}
void comp(int u, int id) {
  vis[u] = sm;
  Id[u] = id;
  int i, j = E[u].size() - 1, v;
  for (i = 0; i <= j; i++) {
    v = E[u][i];
    if (vis[v] != sm) comp(v, id);
  }
}
int find(int p) {
  if (p == par[p]) return p;
  return par[p] = find(par[p]);
}
int main() {
  int n, m, q, u, v, i, a, b, c, l, id = 0;
  scanf("%d%d%d", &n, &m, &q);
  while (m--) {
    scanf("%d%d", &u, &v);
    E[u].push_back(v);
    E[v].push_back(u);
  }
  for (i = 1; i <= n; i++) {
    if (!Id[i]) {
      sm++;
      dia = -1;
      l = dfs(i, 0);
      sm++;
      l = Max(l, dfs(node, 0));
      sm++;
      comp(node, ++id);
      par[id] = id;
      L[id] = dia;
    }
  }
  while (q--) {
    scanf("%d%d", &a, &b);
    if (a == 1)
      printf("%d\n", L[find(Id[b])]);
    else {
      scanf("%d", &a);
      a = find(Id[a]);
      b = find(Id[b]);
      if (a != b) {
        c = Max(L[a], L[b]);
        if (a < b)
          par[b] = a,
          L[a] = (L[a] / 2) + (L[a] % 2) + (L[b] / 2) + (L[b] % 2) + 1,
          L[a] = Max(L[a], c);
        else
          par[a] = b,
          L[b] = (L[b] / 2) + (L[b] % 2) + (L[a] / 2) + (L[a] % 2) + 1,
          L[b] = Max(L[b], c);
      }
    }
  }
  return 0;
}
