#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const int INF = 1e9 + 7;
const long long MOD = 1e9 + 7;
const int N = 3e5 + 7;
vector<int> g[N];
bool vis[N];
class dsu {
 public:
  vector<int> par;
  vector<int> diameters;
  dsu(int N) {
    par.resize(N + 1);
    diameters.resize(N + 1);
    iota(par.begin(), par.end(), 0);
    fill(diameters.begin(), diameters.end(), 0);
  }
  int find_set(int x) { return par[x] == x ? x : (par[x] = find_set(par[x])); }
  bool merge(int x, int y) {
    int px = find_set(x), py = find_set(y);
    if (px == py) return false;
    int fd = (diameters[px] + 1) / 2;
    int fs = (diameters[py] + 1) / 2;
    diameters[py] = max({diameters[px], diameters[py], fs + fd + 1});
    par[px] = py;
    return true;
  }
};
pair<int, int> dfs(int ver, int par = -1, int dist = 0) {
  pair<int, int> mx = {dist, ver};
  vis[ver] = 1;
  for (auto child : g[ver]) {
    if (child == par) continue;
    pair<int, int> t = dfs(child, ver, dist + 1);
    mx = max(mx, t);
  }
  return mx;
}
int find_diameter(int src) {
  pair<int, int> p = dfs(src);
  pair<int, int> ans = dfs(p.second);
  return ans.first;
}
void solve() {
  int n, m, q;
  cin >> n >> m >> q;
  dsu dsu(n);
  int x, y;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
    dsu.merge(x, y);
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    dsu.diameters[dsu.find_set(i)] = find_diameter(i);
  }
  for (int qq = 0; qq < q; qq++) {
    int t;
    cin >> t;
    if (t == 1) {
      int x;
      cin >> x;
      cout << dsu.diameters[dsu.find_set(x)] << endl;
    } else {
      assert(t == 2);
      int x, y;
      cin >> x >> y;
      dsu.merge(x, y);
    }
  }
}
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int tt = 1;
  for (int tc = 1; tc <= tt; tc++) {
    solve();
  }
}
