#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void si(T &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c<48 | c> 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
long long bigmod(long long p, long long e, long long M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return ret;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long modinverse(long long a, long long M) { return bigmod(a, M - 2, M); }
void io() { freopen("/Users/MyMac/Desktop/in.txt", "r", stdin); }
const int N = 3e5 + 5;
int d[N], P[N];
int F[N];
int Tree[N];
bool vis[N];
int dia[N];
vector<int> Nodes[N], G[N];
int col = 0;
void dfs(int u, int p = -1) {
  vis[u] = 1;
  Nodes[col].push_back((u));
  for (auto a : G[u])
    if (a != p) {
      d[a] = 1 + d[u];
      P[a] = u;
      dfs(a, u);
    }
}
int f(int u) {
  if (F[u] == u)
    return u;
  else
    return F[u] = f(F[u]);
}
int main() {
  int n, m, q;
  si(n);
  si(m);
  si(q);
  for (int i = 0; i < (m); i++) {
    int a, b;
    si(a);
    si(b);
    G[a].push_back((b));
    G[b].push_back((a));
  }
  for (int i = 1; i <= n; i++) F[i] = i, dia[i] = 0;
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) {
      d[i] = 0;
      dfs(i);
      int root = -1, iM = -1;
      for (auto a : Nodes[col]) {
        if (d[a] > iM) {
          iM = d[a];
          root = a;
        }
        d[a] = 0;
      }
      Nodes[col].clear();
      d[root] = 0;
      dfs(root);
      iM = -1;
      int end = -1;
      for (auto a : Nodes[col]) {
        if (d[a] > iM) {
          end = a;
          iM = d[a];
        }
      }
      root = end;
      for (int i = 0; i < d[end] / 2; i++) root = P[root];
      dia[col] = iM;
      for (auto a : Nodes[col]) F[a] = root, Tree[a] = col;
      col++;
    }
  }
  while (q--) {
    int t;
    si(t);
    if (t == 1) {
      int x;
      si(x);
      int u = f(x);
      printf("%d\n", dia[Tree[u]]);
    } else {
      int x, y;
      si(x);
      si(y);
      int u = f(x), v = f(y);
      if (u != v) {
        F[u] = v;
        dia[Tree[v]] =
            ((dia[Tree[v]]) >
                     ((dia[Tree[u]] + 1) / 2 + (dia[Tree[v]] + 1) / 2 + 1)
                 ? (dia[Tree[v]])
                 : ((dia[Tree[u]] + 1) / 2 + (dia[Tree[v]] + 1) / 2 + 1));
        dia[Tree[v]] =
            ((dia[Tree[v]]) > (dia[Tree[u]]) ? (dia[Tree[v]]) : (dia[Tree[u]]));
        Tree[u] = Tree[v];
      }
    }
  }
  return 0;
}
