#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <class T, class U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &x) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-' && c != -1)
    ;
  if (c == -1) return;
  if (c == '-') sg = 1, c = getchar();
  for (x = 0; c >= '0' && c <= '9';
       x = (x << 1) + (x << 3) + c - '0', c = getchar())
    ;
  if (sg) x = -x;
}
template <class T>
void print(T x) {
  if (x < 0) return putchar('-'), print(-x);
  if (x < 10) {
    putchar(x + '0');
    return;
  }
  print(x / 10);
  putchar(x % 10 + '0');
}
template <class U, class V>
inline void gn(U &u, V &v) {
  gn(u);
  gn(v);
}
template <class U, class V, class W>
inline void gn(U &u, V &v, W &w) {
  gn(u);
  gn(v, w);
}
template <class T>
void println(T x) {
  print(x);
  putchar('\n');
}
template <class T>
void printsp(T x) {
  print(x);
  putchar(' ');
}
template <class U, class V>
inline void print(U u, V v) {
  printsp(u);
  println(v);
}
template <class U, class V, class W>
inline void print(U u, V v, W w) {
  printsp(u);
  print(v, w);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; a = (long long)a * a % m, b >>= 1)
    if (b & 1) ans = (long long)ans * a % m;
  return ans;
}
vector<int> adj[330303];
int root[330303], sz[330303], D[330303], vst[330303];
int tmp;
int find(int first) {
  while (first != root[first]) first = root[first];
  return first;
}
bool same(int a, int b) { return find(a) == find(b); }
void unite(int a, int b) {
  a = find(a);
  b = find(b);
  if (a == b) return;
  if (sz[a] < sz[b]) swap(a, b);
  sz[a] += sz[b];
  root[b] = a;
  D[a] = max(D[a], max(D[b], (D[a] + 1) / 2 + (D[b] + 1) / 2 + 1));
}
int dfs(int u) {
  vst[u] = 1;
  int mx[2] = {
      0,
  };
  for (int i = adj[u].size(); i--;) {
    int v = adj[u][i];
    if (vst[v]) continue;
    smax(mx[1], dfs(v) + 1);
    if (mx[0] < mx[1]) swap(mx[0], mx[1]);
  }
  smax(tmp, mx[0] + mx[1]);
  return mx[0];
}
void init(int n) {
  for (int i = 1; i <= n; i++) root[i] = i, sz[i] = 1;
}
int main() {
  int n, m, q;
  gn(n, m, q);
  init(n);
  int u, v;
  for (int i = 0; i < m; i++) {
    gn(u, v);
    adj[u].push_back(v);
    adj[v].push_back(u);
    unite(u, v);
  }
  for (int i = 1; i <= n; i++) {
    if (vst[i]) continue;
    tmp = 0;
    dfs(i);
    D[find(i)] = tmp;
  }
  int a, b;
  while (q--) {
    int t;
    gn(t);
    if (t == 1) {
      gn(a);
      a = find(a);
      println(D[a]);
    } else {
      gn(a, b);
      unite(a, b);
    }
  }
  return 0;
}
