#include <bits/stdc++.h>
using namespace std;
int father[300002];
bool visited1[300002];
bool visited2[300002];
int paths[300002];
int lens[300002];
int siz[300002];
vector<int> susedi[300002];
int findf(int a) {
  if (father[a] == 0) {
    return a;
  }
  return father[a] = findf(father[a]);
}
void unitef1(int a, int b) {
  a = findf(a);
  b = findf(b);
  if (siz[a] > siz[b]) {
    swap(a, b);
  }
  siz[b] += siz[a];
  father[a] = b;
}
void unitef2(int a, int b) {
  a = findf(a);
  b = findf(b);
  if (siz[a] > siz[b]) {
    swap(a, b);
  }
  siz[b] += siz[a];
  father[a] = b;
  lens[b] =
      max((lens[b] + 1) / 2 + (lens[a] + 1) / 2 + 1, max(lens[a], lens[b]));
}
int m, mi;
void dfs1(int v, int l) {
  visited1[v] = 1;
  if (l > m) {
    m = l;
    mi = v;
  }
  for (int i = 0; i < susedi[v].size(); i++) {
    if (!visited1[susedi[v][i]]) {
      dfs1(susedi[v][i], l + 1);
    }
  }
}
void dfs2(int v, int l) {
  visited2[v] = 1;
  if (l > m) {
    m = l;
    mi = v;
  }
  for (int i = 0; i < susedi[v].size(); i++) {
    if (!visited2[susedi[v][i]]) {
      dfs2(susedi[v][i], l + 1);
    }
  }
}
int main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, e, q;
  cin >> n >> e >> q;
  for (int i = 1; i <= n; i++) {
    siz[i] = 1;
  }
  for (int i = 0; i < e; i++) {
    int a, b;
    cin >> a >> b;
    susedi[a].push_back(b);
    susedi[b].push_back(a);
    unitef1(a, b);
  }
  for (int i = 1; i <= n; i++) {
    if (!visited1[i]) {
      m = 0;
      dfs1(i, 0);
      m = 0;
      dfs2(mi, 0);
      lens[findf(i)] = m;
    }
  }
  for (int i = 0; i < q; i++) {
    int a;
    cin >> a;
    if (a == 1) {
      int b;
      cin >> b;
      cout << lens[findf(b)] << "\n";
    } else {
      int b, c;
      cin >> b >> c;
      if (findf(b) != findf(c)) {
        unitef2(b, c);
      }
    }
  }
  return 0;
}
