#include <bits/stdc++.h>
using namespace std;
const int N = (int)3e5 + 7;
int n, m, q;
int sz[N], p[N], mx[N];
int findSet(int v) {
  if (p[v] == v) return v;
  return p[v] = findSet(p[v]);
}
void mergeSets(int a, int b) {
  a = findSet(a);
  b = findSet(b);
  if (a == b) return;
  if (sz[a] < sz[b]) swap(a, b);
  p[b] = a;
  sz[a] += sz[b];
  mx[a] = max((mx[a] + 1) / 2 + (mx[b] + 1) / 2 + 1, max(mx[b], mx[a]));
}
vector<int> g[N];
char used[N];
void dfs(int v, int& d, int& ans) {
  used[v] = true;
  vector<int> mxs;
  d = 0, ans = 0;
  for (size_t i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (!used[to]) {
      int dep, toAns;
      dfs(to, dep, toAns);
      ans = max(ans, toAns);
      d = max(d, dep + 1);
      mxs.push_back(dep + 1);
      sort(mxs.begin(), mxs.end());
      if (mxs.size() > 2) mxs.erase(mxs.begin());
      int a = findSet(to);
      int b = findSet(v);
      if (sz[a] < sz[b]) swap(a, b);
      p[a] = b;
      sz[a] += sz[b];
    }
  }
  int sum = 0;
  for (int i = 0; i < mxs.size(); ++i) sum += mxs[i];
  ans = max(ans, sum);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> q;
  for (int i = 0; i < n; ++i) {
    p[i] = i;
    sz[i] = 1;
    mx[i] = 0;
  }
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 0; i < n; ++i) {
    if (!used[i]) {
      int ans, d;
      dfs(i, d, ans);
      mx[findSet(i)] = ans;
    }
  }
  for (int i = 0; i < q; ++i) {
    int tp;
    cin >> tp;
    if (tp == 1) {
      int x;
      cin >> x;
      --x;
      int id = findSet(x);
      cout << mx[id] << endl;
    } else {
      int x, y;
      cin >> x >> y;
      --x, --y;
      mergeSets(x, y);
    }
  }
  return 0;
}
