#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
template <typename Arg1>
void pr(Arg1&& arg1) {
  cout << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void pr(Arg1&& arg1, Args&&... args) {
  cout << arg1 << " ";
  pr(args...);
}
template <typename Arg1>
void rd(Arg1& arg1) {
  cin >> arg1;
}
template <typename Arg1, typename... Args>
void rd(Arg1& arg1, Args&... args) {
  cin >> arg1;
  rd(args...);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& p) {
  out << p.first << " " << p.second;
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  for (T i : v) {
    out << i << " ";
  }
  return out;
}
template <typename Arg1>
void deb(const char* name, Arg1&& arg1) {
  cout << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void deb(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " = " << arg1;
  deb(comma, args...);
}
const long long mxn = 300500;
long long parent[mxn], dia[mxn];
vector<vector<long long> > g;
long long mxv, mxi;
void init() {
  for (long long i = 0; i < mxn; ++i) {
    parent[i] = i;
    dia[i] = 0;
  }
}
long long find(long long u) {
  if (parent[u] == u) {
    return u;
  }
  return parent[u] = find(parent[u]);
}
void uni(long long u, long long v) {
  u = find(u);
  v = find(v);
  if (u == v) return;
  parent[u] = v;
}
void uni2(long long u, long long v) {
  u = find(u);
  v = find(v);
  if (u == v) return;
  parent[u] = v;
  dia[v] = ((dia[u] > dia[v] ? dia[u] : dia[v]) >
                    ((dia[u] + 1) / 2) + ((dia[v] + 1) / 2) + 1
                ? (dia[u] > dia[v] ? dia[u] : dia[v])
                : ((dia[u] + 1) / 2) + ((dia[v] + 1) / 2) + 1);
}
void dfs(long long cur, long long par, long long dep) {
  if (dep > mxi) {
    mxi = dep;
    mxv = cur;
  }
  for (long long i : g[cur]) {
    if (i != par) {
      dfs(i, cur, dep + 1);
    }
  }
}
long long Dia(long long u) {
  mxi = -1;
  dfs(u, 0, 0);
  mxi = -1;
  dfs(mxv, 0, 0);
  return mxi;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m, q;
  cin >> n >> m >> q;
  init();
  g = vector<vector<long long> >(n + 1, vector<long long>());
  for (long long i = 0; i < m; ++i) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
    uni(u, v);
  }
  vector<long long> vis(n + 1, 0);
  for (long long i = 0; i < n; ++i) {
    long long pp = find(i);
    if (!vis[pp]) {
      dia[pp] = Dia(pp);
      vis[pp] = 1;
    }
  }
  while (q--) {
    long long tp, x, y;
    cin >> tp;
    if (tp == 1) {
      cin >> x;
      cout << dia[find(x)] << '\n';
    } else {
      cin >> x >> y;
      uni2(x, y);
    }
  }
  return 0;
}
