#include <bits/stdc++.h>
typedef struct node {
  int x;
  struct node* next;
} node;
typedef node* pnode;
pnode ds[300005];
int parent[300005], tg[300005], f[300005];
int count, res, max;
void adde(int u, int v) {
  pnode p = new node[1];
  p->x = v;
  p->next = ds[u];
  ds[u] = p;
}
void dfs_build_dsu(int u, int len) {
  tg[u] = count;
  if (max < len) {
    max = len;
    res = u;
  }
  pnode p = ds[u];
  while (p != NULL) {
    if (tg[p->x] < count) {
      if (parent[u] > 0)
        parent[p->x] = parent[u];
      else
        parent[p->x] = u;
      parent[parent[p->x]]--;
      dfs_build_dsu(p->x, len + 1);
    }
    p = p->next;
  }
}
void dfs_find_max(int u, int len) {
  tg[u] = count;
  if (max < len) {
    max = len;
  }
  pnode p = ds[u];
  while (p != NULL) {
    if (tg[p->x] < count) {
      dfs_find_max(p->x, len + 1);
    }
    p = p->next;
  }
}
int find_root(int u) {
  if (parent[u] < 1) return u;
  int tmp = find_root(parent[u]);
  parent[u] = tmp;
  return tmp;
}
void merge(int u, int v) {
  int tmp1, tmp2;
  tmp1 = find_root(u);
  tmp2 = find_root(v);
  if (tmp1 == tmp2) return;
  if (parent[tmp1] < parent[tmp2]) {
    parent[tmp1] += parent[tmp2];
    parent[tmp2] = tmp1;
    if (f[tmp1] < (f[tmp1] + 1) / 2 + (f[tmp2] + 1) / 2 + 1)
      f[tmp1] = (f[tmp1] + 1) / 2 + (f[tmp2] + 1) / 2 + 1;
    if (f[tmp1] < f[tmp2]) f[tmp1] = f[tmp2];
  } else {
    parent[tmp2] += parent[tmp1];
    parent[tmp1] = tmp2;
    if (f[tmp2] < (f[tmp1] + 1) / 2 + (f[tmp2] + 1) / 2 + 1)
      f[tmp2] = (f[tmp1] + 1) / 2 + (f[tmp2] + 1) / 2 + 1;
    if (f[tmp2] < f[tmp1]) f[tmp2] = f[tmp1];
  }
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) {
    ds[i] = NULL;
    tg[i] = 0;
    f[i] = 0;
    parent[i] = 0;
  }
  count = 1;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adde(u, v);
    adde(v, u);
  }
  for (int i = 1; i <= n; i++)
    if (parent[i] == 0) {
      parent[i] = -1;
      max = 0;
      res = i;
      count++;
      dfs_build_dsu(i, 0);
      if (res != i) {
        max = 0;
        count++;
        dfs_find_max(res, 0);
        f[i] = max;
      }
    }
  for (int i = 0; i < q; i++) {
    int qc;
    scanf("%d", &qc);
    if (qc == 1) {
      scanf("%d", &qc);
      printf("%d\n", f[find_root(qc)]);
    } else {
      int x;
      scanf("%d%d", &qc, &x);
      merge(qc, x);
    }
  }
  return 0;
}
