#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii>
using vec = vector<T>;
const ll INF = 1e18, MOD = 1e9 + 7;
const int MAX = 1e6;
struct DSU {
  vector<int> parent, set_size;
  set<int> roots;
  vii val;
  DSU() {}
  DSU(int n) { assign(n); }
  void assign(int n) {
    val.assign(n, 0);
    parent.resize(n);
    set_size.assign(n, 1);
    iota(parent.begin(), parent.end(), 0);
    roots.insert(parent.begin(), parent.end());
  }
  void set_val(int x, int v) { val[root(x)] = v; }
  int get_val(int x) { return val[root(x)]; }
  bool check(int a, int b) { return root(a) == root(b); }
  int root(int x) {
    vector<int> v;
    while (x != parent[x]) {
      v.emplace_back(x);
      x = parent[x];
    }
    for (int e : v) parent[e] = x;
    return x;
  }
  int size() { return roots.size(); }
  int size(int i) { return set_size[root(i)]; }
  bool join(int a, int b) {
    a = root(a), b = root(b);
    if (a == b) return false;
    if (set_size[a] < set_size[b]) swap(a, b);
    roots.erase(b);
    set_size[a] += set_size[b];
    parent[b] = a;
    return true;
  }
};
vec<> adj;
vii dp;
DSU d;
int dfs(int curr = 0, int prev = -1) {
  priority_queue<int, vector<int>, greater<int> > q;
  dp[curr] = 0;
  for (int node : adj[curr]) {
    if (node == prev) {
      continue;
    }
    int ans = dfs(node, curr);
    dp[curr] = max(dp[curr], dp[node]);
    q.push(ans);
    if (q.size() > 2) q.pop();
    d.join(curr, node);
  }
  int a = 0, b = 0;
  if (q.size()) {
    a = 1 + q.top();
    q.pop();
  }
  if (q.size()) {
    b = 1 + q.top();
    q.pop();
  }
  dp[curr] = max(a + b, dp[curr]);
  return max(a, b);
}
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n, m, q;
  cin >> n >> m >> q;
  adj.resize(n);
  dp.resize(n, 1);
  d.assign(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    adj[u].emplace_back(v);
    adj[v].emplace_back(u);
  }
  for (int i = 0; i < n; i++) {
    if (d.size(i) > 1) continue;
    dfs(i);
    d.set_val(i, dp[i]);
  }
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      int x;
      cin >> x;
      x--;
      cout << d.get_val(x) << '\n';
    } else {
      int x, y;
      cin >> x >> y;
      x--, y--;
      if (d.check(x, y)) continue;
      int a = d.get_val(x), b = d.get_val(y), c = max(a, b);
      c = max(c, (a + 1) / 2 + (b + 1) / 2 + 1);
      d.join(x, y);
      d.set_val(x, c);
    }
  }
}
