#include <bits/stdc++.h>
using namespace std;
int n, m, T, x, y, type, maxi, maxiV;
int diam[300005], p[300005], a[300005];
bool viz[300005];
vector<vector<int> > v;
void init();
void dfs(int node, int lg, int p);
int grp(int x);
void update1(int x, int y);
void update2(int x, int y);
int mndr(int node);
int query(int x);
void read(int &x) {
  int sign = 1;
  char ch;
  x = 0;
  while (!isdigit(ch = getchar())) {
    if (ch == '-') {
      sign = -1;
    } else {
      sign = 1;
    }
  }
  do {
    x = x * 10 + ch - '0';
  } while (isdigit(ch = getchar()));
  x *= sign;
}
int main() {
  read(n), read(m), read(T);
  init();
  v.resize(n + 5);
  for (int i = 1; i <= m; ++i) {
    read(x), read(y);
    v[x].push_back(y);
    v[y].push_back(x);
    update1(x, y);
  }
  for (int i = 1; i <= n; i++) {
    int pp = grp(i);
    if (!viz[pp]) {
      viz[pp] = 1;
      diam[pp] = mndr(i);
    }
  }
  for (int i = 1; i <= T; ++i) {
    read(type);
    if (type == 1) {
      read(x);
      printf("%d\n", query(x));
    } else {
      read(x), read(y);
      update2(x, y);
    }
  }
  return 0;
}
void dfs(int node, int lg, int p) {
  if (lg > maxi) {
    maxi = lg;
    maxiV = node;
  }
  for (vector<int>::iterator it = v[node].begin(); it != v[node].end(); ++it) {
    int to = *it;
    if (to != p) dfs(to, lg + 1, node);
  }
}
int mndr(int node) {
  maxi = -1;
  dfs(node, 0, -1);
  maxi = -1;
  dfs(maxiV, 0, -1);
  return maxi;
}
void init() {
  for (int i = 1; i <= n; ++i) {
    p[i] = i;
    a[i] = 1;
    diam[i] = 1;
  }
}
void update1(int x, int y) {
  int rx = grp(x);
  int ry = grp(y);
  if (rx == ry) return;
  if (a[rx] > a[ry]) {
    swap(rx, ry);
  }
  a[rx] += a[ry];
  p[ry] = rx;
}
void update2(int x, int y) {
  int rx = grp(x);
  int ry = grp(y);
  if (rx == ry) return;
  if (a[rx] >= a[ry]) {
    swap(rx, ry);
  }
  a[rx] += a[ry];
  p[ry] = rx;
  diam[rx] =
      max(diam[rx], max(diam[ry], (diam[rx] + 1) / 2 + (diam[ry] + 1) / 2 + 1));
}
int grp(int x) {
  int cx = x;
  while (p[x] != x) {
    x = p[x];
  }
  while (cx != x) {
    int aux = p[cx];
    p[cx] = x;
    cx = aux;
  }
  return x;
}
int query(int x) {
  int qq = grp(x);
  return diam[qq];
}
