#include <bits/stdc++.h>
using namespace std;
long long modpow(long long base, long long exponent, long long modulus) {
  if (base == 0 && exponent == 0) return 0;
  long long result = 1;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = (result * base) % modulus;
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
int a[3 * 100004];
int Rank[3 * 100004];
int n, i, m, x, y;
vector<vector<int> > Adj(3 * 100004);
int find(int x) {
  if (a[x] == x)
    return x;
  else {
    int u = find(a[x]);
    a[x] = u;
    return u;
  }
}
void unii(int x, int y) {
  int ff = x;
  int gg = y;
  if (Rank[ff] > Rank[gg]) {
    a[ff] = gg;
  } else if (Rank[ff] < Rank[gg])
    a[gg] = ff;
  else {
    a[ff] = gg;
    Rank[gg]++;
  }
}
bool visit[3 * 100004];
bool visit1[3 * 100004];
int Dis[3 * 100004];
int Comp[3 * 100004];
int best[3 * 100004];
inline void ReadInput(void) {}
int Max_Dis = -1;
int Com = 1;
vector<int> tmp;
int Con;
void dfs(int node, int lev) {
  tmp.push_back(node);
  visit[node] = true;
  Dis[node] = lev;
  Comp[node] = Com;
  if (Max_Dis < Dis[node]) {
    Con = node;
    Max_Dis = Dis[node];
  }
  for (int i = (0); i < (Adj[node].size()); i++) {
    if (!visit[Adj[node][i]]) {
      dfs(Adj[node][i], lev + 1);
    }
  }
}
void dfs1(int node, int lev) {
  tmp.push_back(node);
  visit1[node] = true;
  Dis[node] = lev;
  Comp[node] = Com;
  if (Max_Dis < Dis[node]) {
    Con = node;
    Max_Dis = Dis[node];
  }
  for (int i = (0); i < (Adj[node].size()); i++) {
    if (!visit1[Adj[node][i]]) {
      dfs1(Adj[node][i], lev + 1);
    }
  }
}
void pre() {
  fill(visit, visit + 3 * 100004, false);
  fill(visit1, visit1 + 3 * 100004, false);
  for (int i = 0; i < n; i++) {
    tmp.clear();
    if (!visit[i]) {
      Max_Dis = -1;
      dfs(i, 0);
      dfs1(Con, 0);
      best[Com] = Max_Dis;
      Com++;
    }
  }
}
inline void solve(void) {
  for (int i = (0); i < (3 * 100004 - 1); i++) {
    a[i] = i;
    Rank[i] = 0;
  }
  int q;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &q);
  for (int i = (0); i < (m); i++) {
    scanf("%d", &x);
    scanf("%d", &y);
    x--;
    y--;
    Adj[x].push_back(y);
    Adj[y].push_back(x);
  }
  pre();
  int tell;
  while (q--) {
    scanf("%d", &tell);
    if (tell == 2) {
      scanf("%d", &x);
      scanf("%d", &y);
      x--;
      y--;
      Comp[x] = find(Comp[x]);
      Comp[y] = find(Comp[y]);
      int c1 = Comp[x];
      int c2 = Comp[y];
      if (c1 == c2) continue;
      int d1 = best[Comp[x]];
      int d2 = best[Comp[y]];
      if (d1 % 2 == 0)
        d1 /= 2;
      else
        d1 = d1 / 2 + 1;
      if (d2 % 2 == 0)
        d2 /= 2;
      else
        d2 = d2 / 2 + 1;
      int make =
          ((best[Comp[x]]) > (best[Comp[y]]) ? best[Comp[x]] : best[Comp[y]]);
      make = ((d1 + 1 + d2) > (make) ? d1 + 1 + d2 : make);
      if (best[Comp[x]] == 1 and best[Comp[y]] == 2) make = 3;
      if (best[Comp[x]] == 2 and best[Comp[y]] == 1) make = 3;
      if (best[Comp[x]] == 1 and best[Comp[y]] == 1) make = 3;
      unii(Comp[x], Comp[y]);
      best[find(Comp[y])] = make;
    }
    if (tell == 1) {
      scanf("%d", &x);
      x--;
      x = find(Comp[x]);
      printf("%d\n", best[x]);
    }
  }
}
int main(int argc, const char* argv[]) {
  ReadInput();
  solve();
  return 0;
}
