#include <bits/stdc++.h>
using namespace std;
class dsu {
 public:
  vector<int> lord;
  vector<int> power;
  vector<int> diametr;
  int minions;
  dsu() {}
  dsu(int n) { start(n); }
  void start(int n) {
    minions = n;
    lord.resize(n);
    power.resize(n);
    diametr.resize(n);
    for (int i = 0; i < n; i++) {
      lord[i] = i;
      power[i] = 1;
      diametr[i] = 0;
    }
  }
  void Union(int x, int y) {
    int a = Track(x);
    int b = Track(y);
    if (Doppel(a, b)) return;
    minions--;
    if (power[a] > power[b]) {
      power[lord[a]] += power[lord[b]];
      lord[b] = lord[a];
    } else {
      power[lord[b]] += power[lord[a]];
      lord[a] = lord[b];
    }
  }
  int Track(int a) {
    int e = a;
    while (lord[e] != e) e = lord[e];
    return lord[e];
  }
  bool Doppel(int a, int b) { return Track(a) == Track(b); }
};
int dist[100000 * 3 + 10];
bool used[100000 * 3 + 10];
bool used2[100000 * 3 + 10];
vector<vector<int> > v;
int bfs(int n) {
  queue<int> q;
  dist[n] = 0;
  for (int i = 0; i < v[n].size(); i++) q.push(v[n][i]);
  used[n] = true;
  q.push(-1);
  int deep = 1;
  int ans = n;
  int deepans = -1;
  while (!q.empty()) {
    int vert = q.front();
    q.pop();
    if (q.size() == 0) break;
    if (vert == -1) {
      deep++;
      q.push(-1);
      continue;
    }
    if (used[vert]) continue;
    if (deep > deepans) {
      deepans = deep;
      ans = vert;
    }
    dist[vert] = deep;
    used[vert] = true;
    for (int i = 0; i < v[vert].size(); i++)
      if (!used[v[vert][i]]) q.push(v[vert][i]);
  }
  return ans;
}
int bfs2(int n) {
  queue<int> q;
  dist[n] = 0;
  for (int i = 0; i < v[n].size(); i++) q.push(v[n][i]);
  used2[n] = true;
  q.push(-1);
  int deep = 1;
  int ans = n;
  int deepans = -1;
  while (!q.empty()) {
    int vert = q.front();
    q.pop();
    if (q.size() == 0) break;
    if (vert == -1) {
      deep++;
      q.push(-1);
      continue;
    }
    if (used2[vert]) continue;
    if (deep > deepans) {
      deepans = deep;
      ans = vert;
    }
    dist[vert] = deep;
    used2[vert] = true;
    for (int i = 0; i < v[vert].size(); i++)
      if (!used2[v[vert][i]]) q.push(v[vert][i]);
  }
  return ans;
}
int findDiametr(int n) {
  int faraway = bfs(n);
  return dist[bfs2(faraway)];
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, q;
  cin >> n >> m >> q;
  dsu CNM(n);
  v.resize(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    CNM.Union(a, b);
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 0; i < n; i++)
    if (!used2[i]) CNM.diametr[CNM.Track(i)] = findDiametr(i);
  vector<int> ans;
  for (int i = 0; i < q; i++) {
    int c, a, b;
    cin >> c;
    if (c == 2) {
      cin >> a >> b;
      a--;
      b--;
      if (CNM.Doppel(a, b)) continue;
      int dim1 = CNM.diametr[CNM.Track(a)];
      int dim2 = CNM.diametr[CNM.Track(b)];
      int newDim =
          max(dim1 / 2 + dim1 % 2 + dim2 / 2 + dim2 % 2 + 1, max(dim1, dim2));
      CNM.Union(a, b);
      CNM.diametr[CNM.Track(a)] = newDim;
    } else {
      cin >> a;
      a--;
      ans.push_back(CNM.diametr[CNM.Track(a)]);
    }
  }
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << "\n";
  return 0;
}
