#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x);
template <typename T>
void write(T x);
template <typename T>
void writesp(T x);
template <typename T>
void writeln(T x);
const long long N = 3e5 + 5;
long long head[N], to[N << 1], tot, MabLcdG[N << 1];
inline void add(long long x, long long y) {
  to[++tot] = y;
  MabLcdG[tot] = head[x];
  head[x] = tot;
}
inline void Link(long long x, long long y) {
  add(x, y);
  add(y, x);
}
long long n, m, q;
long long l[N], r[N], d[N], dis[N];
namespace dsu {
long long f[N];
inline void init(long long lim) {
  for (long long i = 1; i <= lim; i++) f[i] = i;
}
inline long long getf(long long x) { return f[x] == x ? x : f[x] = getf(f[x]); }
inline void merge(long long x, long long y) { f[getf(x)] = getf(y); }
}  // namespace dsu
bool vis[N];
inline void dfs(long long x, long long fa, long long Dis, long long &L) {
  vis[x] = true;
  dis[x] = Dis;
  if (dis[x] > dis[L]) L = x;
  for (long long i = head[x], ver; i; i = MabLcdG[i]) {
    ver = to[i];
    if (ver == fa) continue;
    dfs(ver, x, Dis + 1, L);
  }
}
int main() {
  read(n);
  read(m);
  read(q);
  dsu::init(n);
  for (long long i = 1, x, y; i <= m; i++) {
    read(x);
    read(y);
    Link(x, y);
    if (x > y) swap(x, y);
    dsu::merge(y, x);
  }
  for (long long i = 1; i <= n; i++) {
    if (!vis[i]) {
      dfs(i, 0, 0, l[dsu::getf(i)]);
      dfs(l[dsu::getf(i)], 0, 0, r[dsu::getf(i)]);
      d[dsu::getf(i)] = dis[r[dsu::getf(i)]];
    }
  }
  long long x, y, op;
  while (q--) {
    read(op);
    if (op == 1) {
      read(x);
      writeln(d[dsu::getf(x)]);
    } else {
      read(x);
      read(y);
      x = dsu::getf(x);
      y = dsu::getf(y);
      if (x == y) continue;
      dsu::f[y] = x;
      d[x] = max((d[x] + 1) / 2 + (d[y] + 1) / 2 + 1, max(d[x], d[y]));
    }
  }
}
template <typename T>
void read(T &x) {
  x = 0;
  long long t = 1;
  char wn = getchar();
  while (wn < '0' || wn > '9') {
    if (wn == '-') t = -1;
    wn = getchar();
  }
  while (wn >= '0' && wn <= '9') {
    x = x * 10 + wn - '0';
    wn = getchar();
  }
  x *= t;
}
template <typename T>
void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x <= 9) {
    putchar(x + '0');
    return;
  }
  write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
void writesp(T x) {
  write(x);
  putchar(' ');
}
template <typename T>
void writeln(T x) {
  write(x);
  putchar('\n');
}
