#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T _sq(T a) {
  return a * a;
}
template <class T>
inline T _sqrt(T a) {
  return (T)sqrt((double)a);
}
template <class T, class X>
inline T _pow(T a, X y) {
  T z = 1;
  for (int i = 1; i <= y; i++) {
    z *= a;
  }
  return z;
}
template <class T>
inline T _gcd(T a, T b) {
  a = abs(a);
  b = abs(b);
  if (!b) return a;
  return _gcd(b, a % b);
}
template <class T>
inline T _lcm(T a, T b) {
  a = abs(a);
  b = abs(b);
  return (a / _gcd(a, b)) * b;
}
template <class T>
inline T _extended(T a, T b, T &x, T &y) {
  a = abs(a);
  b = abs(b);
  T g, x1, y1;
  if (!b) {
    x = 1;
    y = 0;
    g = a;
    return g;
  }
  g = _extended(b, a % b, x1, y1);
  x = y1;
  y = x1 - (a / b) * y1;
  return g;
}
template <class T, class X>
inline bool getbit(T a, X i) {
  T t = 1;
  return ((a & (t << i)) > 0);
}
template <class T, class X>
inline T setbit(T a, X i) {
  T t = 1;
  return (a | (t << i));
}
template <class T, class X>
inline T resetbit(T a, X i) {
  T t = 1;
  return (a & (~(t << i)));
}
template <class T, class X>
inline T togglebit(T a, X i) {
  T t = 1;
  return (a ^ (t << i));
}
template <class T>
void pv(T v) {
  for (int i = 0; i < ((int)v.size()); i++) cout << v[i] << " ";
  cout << endl;
}
template <class T, class X>
inline T _bigmod(T n, X m) {
  unsigned long long ret = 1, a = n % 1000000007;
  while (m) {
    if (m & 1) ret = (ret * a) % 1000000007;
    m >>= 1;
    a = (a * a) % 1000000007;
  }
  ret %= 1000000007;
  return (T)ret;
}
template <class T>
inline T _modinv(T n) {
  return _bigmod(n, 1000000007 - 2);
}
int n, m, q, par[(300000 + 3)], mx[(300000 + 3)], mn[(300000 + 3)],
    mx1[(300000 + 3)], mx2[(300000 + 3)];
vector<int> adj[(300000 + 3)], val[(300000 + 3)];
int traverse(int u, int p) {
  int ret = 0;
  for (int i = 0; i < ((int)adj[u].size()); i++) {
    if (adj[u][i] != p) {
      int tmp = 1 + traverse(adj[u][i], u);
      if (tmp > mx1[u]) {
        mx2[u] = mx1[u];
        mx1[u] = tmp;
      } else if (tmp > mx2[u]) {
        mx2[u] = tmp;
      }
      val[u].push_back(tmp);
      ret = max(ret, tmp);
    } else
      val[u].push_back(0);
  }
  return ret;
}
void dfs(int u, int p, int r, int len) {
  par[u] = r;
  mx[r] = max(mx[r], mx1[u] + max(len, mx2[u]));
  mn[r] = min(mn[r], max(mx1[u], len));
  for (int i = 0; i < ((int)adj[u].size()); i++) {
    if (adj[u][i] != p) {
      dfs(adj[u][i], u, r,
          1 + max(len, (mx1[u] == val[u][i] ? mx2[u] : mx1[u])));
    }
  }
  return;
}
int fd(int x) {
  if (par[x] != x) par[x] = fd(par[x]);
  return par[x];
}
void un(int x, int y) {
  int rootx = fd(x), rooty = fd(y);
  if (rootx == rooty) return;
  int tmx = max(mn[rootx] + 1 + mn[rooty], max(mx[rootx], mx[rooty]));
  int tmn = min(max(mn[rootx], mn[rooty] + 1), max(mn[rootx] + 1, mn[rooty]));
  par[rooty] = rootx;
  mn[rootx] = tmn;
  mx[rootx] = tmx;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (!par[i]) {
      mn[i] = 2000000000;
      traverse(i, 0);
      dfs(i, 0, i, 0);
    }
  }
  while (q--) {
    int t, x, y;
    cin >> t >> x;
    if (t == 2) {
      cin >> y;
      un(x, y);
    } else {
      cout << mx[fd(x)] << endl;
    }
  }
  return 0;
}
