#include <bits/stdc++.h>
using namespace std;
const int MaxN = 3 * (int)1e5 + 10;
vector<int> G[MaxN];
int len[MaxN];
int sz[MaxN];
int dad[MaxN];
int t_node, found;
void explore(int x, int parent, int s_dad, int dist) {
  if (dist > found) {
    found = dist, t_node = x;
  }
  dad[x] = s_dad;
  sz[s_dad]++;
  for (int i = 0; i < G[x].size(); ++i) {
    if (G[x][i] != parent) explore(G[x][i], x, s_dad, dist + 1);
  }
}
void dfs(int x, int parent, int dist) {
  found = max(dist, found);
  for (int i = 0; i < G[x].size(); ++i) {
    if (G[x][i] != parent) {
      dfs(G[x][i], x, dist + 1);
    }
  }
}
int get_dad(int x) {
  if (x == dad[x])
    return x;
  else
    return dad[x] = get_dad(dad[x]);
}
void merge_trees(int rep1, int rep2) {
  if (rep1 == rep2) return;
  if (sz[rep1] < sz[rep2]) swap(rep1, rep2);
  sz[rep1] += sz[rep2];
  dad[rep2] = rep1;
  bool odd1 = len[rep1] & 1;
  bool odd2 = len[rep2] & 1;
  int n_len = max(len[rep1], len[rep2]);
  if (odd1 && odd2) {
    if (len[rep1] == len[rep2]) {
      n_len += 2;
    } else if (abs(len[rep1] - len[rep2]) == 2) {
      n_len++;
    }
  } else if (!odd1 && !odd2) {
    if (len[rep1] == len[rep2]) n_len++;
  } else {
    if (abs(len[rep1] - len[rep2]) == 1) n_len++;
  }
  len[rep1] = n_len;
}
int main() {
  int n, m, q;
  scanf("%d%d%d", &n, &m, &q);
  memset(dad, -1, sizeof(dad));
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vector<pair<int, int> > v;
  for (int i = 0; i < n; ++i) {
    if (dad[i] == -1) {
      found = -1;
      explore(i, i, i, 0);
      v.push_back(pair<int, int>(i, t_node));
    }
  }
  for (int i = 0; i < v.size(); ++i) {
    found = -1;
    dfs(v[i].second, v[i].second, 0);
    len[v[i].first] = found;
  }
  for (int i = 0; i < q; ++i) {
    int c, x, y;
    scanf("%d %d", &c, &x);
    --x;
    if (c == 1) {
      printf("%d\n", len[get_dad(x)]);
    } else {
      scanf("%d", &y);
      --y;
      merge_trees(get_dad(x), get_dad(y));
    }
  }
  return 0;
}
