#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
const long long int inf = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
const double PI = acos(-1);
long long int i, j, k;
void solve(void);
inline bool equal(double a, double b) { return fabs(a - b) < eps; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  int t = 1;
  while (t--) solve();
  return 0;
}
vector<long long int> node[300005], ind;
long long int dsu[300005], val[300005], siz[300005];
bool vis[300005];
void init() {
  int i;
  for (i = (1); i <= (300005 - 1); ++i) dsu[i] = i, val[i] = 0, siz[i] = 1;
}
long long int find_parent(int idx) {
  if (dsu[idx] == idx) return idx;
  return dsu[idx] = find_parent(dsu[idx]);
}
void merge(int idx1, int idx2) {
  idx1 = find_parent(idx1);
  idx2 = find_parent(idx2);
  if (idx1 == idx2) return;
  if (siz[idx1] < siz[idx2]) swap(idx1, idx2);
  dsu[idx2] = idx1;
  siz[idx1] += siz[idx2];
  long long int t = (val[idx1] + 1) / 2 + (val[idx2] + 1) / 2 + 1;
  val[idx1] = ((((val[idx1]) > (val[idx2]) ? (val[idx1]) : (val[idx2]))) > (t)
                   ? (((val[idx1]) > (val[idx2]) ? (val[idx1]) : (val[idx2])))
                   : (t));
}
void dfs(int idx) {
  vis[idx] = 1;
  ind.emplace_back(idx);
  for (auto it : node[idx])
    if (!vis[it]) dfs(it);
}
void farthest_dfs(int idx, int h, int& ans, int& index) {
  vis[idx] = 1;
  if (ans < h) {
    ans = h;
    index = idx;
  }
  for (auto it : node[idx])
    if (!vis[it]) farthest_dfs(it, h + 1, ans, index);
}
void solve() {
  int n, m, q;
  cin >> n >> m >> q;
  for (i = (1); i <= (m); ++i) {
    int u, v;
    cin >> u >> v;
    node[u].emplace_back(v);
    node[v].emplace_back(u);
  }
  for (i = (1); i <= (n); ++i)
    if (!vis[i]) {
      ind.clear();
      dfs(i);
      siz[i] = (int)ind.size();
      for (auto it : ind) dsu[it] = i, vis[it] = 0;
      int ans = 0, index = i;
      farthest_dfs(index, 0, ans, index);
      ans = 0;
      for (auto it : ind) vis[it] = 0;
      farthest_dfs(index, 0, ans, index);
      val[i] = ans;
      for (auto it : ind) vis[it] = 1;
    }
  while (q--) {
    int t;
    cin >> t;
    if (t == 1) {
      int x;
      cin >> x;
      cout << val[find_parent(x)] << '\n';
    } else {
      int x, y;
      cin >> x >> y;
      merge(x, y);
    }
  }
}
