#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 3e5 + 5;
using namespace std;
vector<int> adj[MAXN];
deque<pair<int, int> > qu;
int par[MAXN], vis[MAXN], dist[MAXN], _size[MAXN];
int query(int x) {
  if (par[x] != x) return par[x] = query(par[x]);
  return x;
}
void _merge(int x, int y, int flag) {
  int a = query(x), b = query(y);
  if (a != b) {
    par[a] = b;
    if (!flag) return;
    int l1 = _size[a], l2 = _size[b];
    int tmp = 1;
    if (l1 & 1)
      tmp += (l1 + 1) >> 1;
    else
      tmp += l1 >> 1;
    if (l2 & 1)
      tmp += (l2 + 1) >> 1;
    else
      tmp += l2 >> 1;
    _size[b] = max(max(l1, l2), tmp);
  }
}
void update(int x, int second) {
  int y = query(x);
  _size[y] = second;
}
int main() {
  int n, m, q;
  scanf("%d %d %d", &n, &m, &q);
  for (int i = 0; i < n; i++) par[i] = i, dist[i] = INF, _size[i] = 0;
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
    _merge(u, v, 0);
  }
  for (int i = 0; i < n; i++) {
    if (vis[i]) continue;
    qu.push_back({i, 0});
    dist[i] = 0;
    vector<int> proc;
    pair<int, int> _max = {-1, -1};
    while (!qu.empty()) {
      int id = qu.front().first;
      qu.pop_front();
      if (_max.second < dist[id]) {
        _max.first = id;
        _max.second = dist[id];
      }
      proc.push_back(id);
      for (int u : adj[id]) {
        if (dist[u] > dist[id] + 1) {
          dist[u] = dist[id] + 1;
          qu.push_back({u, dist[u]});
        }
      }
    }
    for (int u : proc) dist[u] = INF;
    dist[_max.first] = 0;
    qu.push_back({_max.first, 0});
    _max = {-1, -1};
    while (!qu.empty()) {
      int id = qu.front().first;
      qu.pop_front();
      vis[id] = 1;
      if (_max.second < dist[id]) {
        _max.first = id;
        _max.second = dist[id];
      }
      for (int u : adj[id]) {
        if (dist[u] > dist[id] + 1) {
          dist[u] = dist[id] + 1;
          qu.push_back({u, dist[u]});
        }
      }
    }
    update(_max.first, _max.second);
  }
  for (int i = 0; i < q; i++) {
    int t, u, v;
    scanf("%d %d", &t, &u);
    if (t == 2) scanf("%d", &v);
    u--, v--;
    if (t == 1) {
      int id = query(u);
      printf("%d\n", _size[id]);
    } else {
      _merge(u, v, 1);
    }
  }
  return 0;
}
