#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
  point() {}
  point(int a, int b) { x = a, y = b; }
};
template <class T>
T sqr(T a) {
  return a * a;
}
template <class T>
T power(T n, T p) {
  T res = 1;
  for (int i = 0; i < p; i++) res *= n;
  return res;
}
template <class T>
double getdist(T a, T b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
template <class T>
T extract(string s, T ret) {
  stringstream ss(s);
  ss >> ret;
  return ret;
}
template <class T>
string tostring(T n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
template <class T>
inline T Mod(T n, T m) {
  return (n % m + m) % m;
}
template <class T>
void print_all(T v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << ' ';
};
template <class T>
void print_all(T &v, int len) {
  for (int i = 0; i < len; i++) cout << v[i] << ' ';
}
template <class T>
void print_pair(T v, int len) {
  for (int i = 0; i < len; i++)
    cout << v[i].first << ' ' << v[i].second << endl;
}
long long bigmod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
int par[300010], dist[300010], max_dist, far_node;
vector<int> adj[300010];
int find_par(int node) {
  if (node == par[node]) return node;
  return par[node] = find_par(par[node]);
}
void dfs(int node, int par, int d) {
  if (d > max_dist) {
    max_dist = d;
    far_node = node;
  }
  int i;
  for (i = 0; i < (int)(adj[node].size()); i++) {
    if (adj[node][i] == par) continue;
    dfs(adj[node][i], node, d + 1);
  }
}
int find_dist(int node) {
  max_dist = -1;
  dfs(node, -1, 0);
  max_dist = -1;
  dfs(far_node, -1, 0);
  return max_dist;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, q, a, b, i, tem;
  cin >> n >> m >> q;
  for (i = 0; i <= n; i++) par[i] = i;
  while (m--) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
    a = find_par(a);
    b = find_par(b);
    if (a != b) {
      par[a] = b;
    }
  }
  for (i = 1; i <= n; i++)
    if (par[i] == i) dist[i] = find_dist(i);
  while (q--) {
    cin >> m;
    if (m == 1) {
      cin >> a;
      a = find_par(a);
      cout << dist[a] << endl;
    } else {
      cin >> a >> b;
      a = find_par(a);
      b = find_par(b);
      if (a != b) {
        int x = dist[find_par(a)];
        int y = dist[find_par(b)];
        tem = max(x, y);
        tem = max(tem, (x + 1) / 2 + (y + 1) / 2 + 1);
        dist[a] = tem;
        dist[b] = tem;
        par[a] = b;
      }
    }
  }
  return 0;
}
