#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int N = 300005;
const double PI = 4 * atan(1);
const long long MAX = 9223372036854775807;
int dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, 1, -1, 1, 1, -1, -1};
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
bool issquare(long long w) { return trunc(sqrt(w)) * trunc(sqrt(w)) == w; }
bool isprime(long long u) {
  for (long long i = 2; i <= (int)sqrt(u); i++) {
    if (u % i == 0) return 0;
  }
  return 1;
}
long long mod(long long to_mod, long long MOD) {
  to_mod %= MOD;
  while (to_mod < 0) to_mod += MOD;
  return to_mod % MOD;
}
long long moduloMultiplication(long long a, long long b, long long mod) {
  long long res = 0;
  a %= mod;
  while (b) {
    if (b & 1) res = (res + a) % mod;
    a = (2 * a) % mod;
    b >>= 1;
  }
  return res;
}
long long power(long long x, long long y) {
  long long res = 1;
  x = x;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return res;
}
long long n, m, x, q, y, k, z, w, t, l, r, res, ans, dfsroot, xx, yy;
long long id[N];
long long dp[N];
long long dist[N];
vector<long long> adj[N];
bool vis[N];
void dfs(long long src) {
  if (vis[src]) return;
  vis[src] = 1;
  id[src] = dfsroot;
  vector<long long> v;
  long long to_return = 0;
  for (auto t : adj[src]) {
    if (vis[t]) continue;
    dfs(t);
    v.push_back(1 + dist[t]);
  }
  sort(v.rbegin(), v.rend());
  long long a = v.size();
  dist[src] = 0;
  for (int i = 0; i < min(2ll, a); i++) {
    to_return += v[i];
    dist[src] = max(dist[src], v[i]);
  }
  dp[dfsroot] = max(dp[dfsroot], to_return);
}
long long parent(long long src) {
  while (src != id[src]) {
    id[src] = id[id[src]];
    src = id[src];
  }
  return src;
}
void update(long long xx, long long yy) {
  id[xx] = yy;
  long long a = dp[xx];
  long long b = dp[yy];
  dp[yy] = max(dp[yy], a);
  dp[yy] = max(dp[yy], (a + 1) / 2 + (b + 1) / 2 + 1);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m >> q;
  for (int i = 0; i < n; i++) {
    id[i] = i;
  }
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    x--;
    y--;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 0; i < n; i++) {
    if (vis[i]) continue;
    dp[i] = 0;
    dfsroot = i;
    dfs(i);
  }
  while (q--) {
    cin >> z;
    if (z == 1) {
      cin >> x;
      x--;
      xx = parent(x);
      cout << dp[xx] << "\n";
    } else {
      cin >> x >> y;
      x--;
      y--;
      xx = parent(x);
      yy = parent(y);
      if (xx == yy) {
        continue;
      } else {
        update(xx, yy);
      }
    }
  }
  return 0;
}
