#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline int read(T& x) {
  x = 0;
  char c = getchar(), f = 1;
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    if (c == -1) return -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0')
    x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
  x *= f;
  return 1;
}
template <typename T, typename... Args>
inline int read(T& x, Args&... args) {
  return read(x) + read(args...);
}
template <typename T>
inline int write(T x) {
  if (x < 0) return putchar('-') & write((~x) + 1);
  if (x / 10) return write(x / 10) & putchar(x % 10 | 48);
  return putchar(x | 48);
}
template <typename T>
inline int write(T x, char c) {
  return write(x) + putchar(c);
}
struct edge {
  int v, nxt;
  inline edge() {}
} e[300005 << 1];
int f[300005], tot;
inline void addEdge(int u, int v) {
  tot++, e[tot].v = v, e[tot].nxt = f[u], f[u] = tot;
}
bool vis[300005];
inline pair<int, int> dfs(int x) {
  if (vis[x]) return make_pair(-1, -1);
  vis[x] = 1;
  pair<int, int> ans(0, x);
  for (int i = f[x]; i; i = e[i].nxt) {
    pair<int, int> tmp = dfs(e[i].v);
    tmp.first++;
    ans = ((ans) > (tmp) ? (ans) : (tmp));
  }
  vis[x] = 0;
  return ans;
}
bool dd[300005];
inline int doftree(int x) {
  pair<int, int> t = dfs(x);
  pair<int, int> tt = dfs(t.second);
  return tt.first;
}
int fa[300005];
inline void init() {
  for (int i = 1; i < 300005; i++) fa[i] = i;
}
inline int findSet(int x) {
  while (x != fa[x]) x = fa[x] = fa[fa[x]];
  return x;
}
inline void unionSet(int x, int y) { fa[findSet(x)] = findSet(y); }
inline bool same(int x, int y) { return findSet(x) == findSet(y); }
int n, m, q;
int d[300005];
signed main() {
  read(n, m, q);
  init();
  for (int i = 1, u, v; i <= m; i++) {
    read(u, v);
    addEdge(u, v), addEdge(v, u);
    unionSet(u, v);
  }
  for (int i = 1; i <= n; i++) {
    if (!dd[findSet(i)])
      d[i] = doftree(i), d[findSet(i)] = d[i];
    else
      d[i] = d[findSet(i)];
    dd[findSet(i)] = 1;
  }
  for (int i = 1; i <= q; i++) {
    int ty;
    read(ty);
    int x, y;
    if (ty == 1) {
      read(x);
      write(d[findSet(x)], '\n');
    }
    if (ty == 2) {
      read(x, y);
      if (same(x, y)) continue;
      int dx = d[findSet(x)], dy = d[findSet(y)];
      unionSet(x, y);
      d[findSet(x)] = ((((dx + 1) >> 1) + ((dy + 1) >> 1) + 1) >
                               (((dx) > (dy) ? (dx) : (dy)))
                           ? (((dx + 1) >> 1) + ((dy + 1) >> 1) + 1)
                           : (((dx) > (dy) ? (dx) : (dy))));
    }
  }
}
