#include <bits/stdc++.h>
using namespace std;
namespace Flandle_Scarlet {
class Graph {
 public:
  int head[300100];
  int EdgeCount;
  struct Edge {
    int To, Label, Next;
  } Ed[300100 << 1];
  void clear() {
    memset(Ed, -1, sizeof(Ed));
    memset(head, -1, sizeof(head));
    EdgeCount = 0;
  }
  void AddEdge(int u, int v, int w) {
    ++EdgeCount;
    Ed[EdgeCount] = (Edge){v, w, head[u]};
    head[u] = EdgeCount;
  }
  int Start(int u) { return head[u]; }
  int To(int u) { return Ed[u].To; }
  int Label(int u) { return Ed[u].Label; }
  int Next(int u) { return Ed[u].Next; }
} G;
void Add(int u, int v, int w) {
  G.AddEdge(u, v, w);
  G.AddEdge(v, u, w);
}
class DSU {
 public:
  int Father[300100], Cnt[300100];
  void Init() {
    for (int i = 0; i < 300100; i++) {
      Father[i] = i;
      Cnt[i] = 1;
    }
  }
  int Find(int x) {
    return (x == Father[x]) ? x : (Father[x] = Find(Father[x]));
  }
} D;
int n, m, q;
void Input() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    Add(u, v, 1);
  }
}
int maxlen[300100];
int ans = -1;
int root;
int furthest;
void DFS(int u, int pre, int dis) {
  D.Father[u] = root;
  if (dis > ans) {
    ans = dis;
    furthest = u;
  }
  for (int i = G.Start(u); ~i; i = G.Next(i)) {
    int v = G.To(i);
    if (v != pre) {
      DFS(v, u, dis + 1);
    }
  }
}
void IntelligentMerge(int u, int v) {
  int au = D.Find(u), av = D.Find(v);
  if (au == av) return;
  int su = maxlen[au], sv = maxlen[av];
  if (su < sv) {
    swap(maxlen[au], maxlen[av]);
    swap(su, sv);
  }
  D.Father[av] = au;
  maxlen[au] = max(su, (su + 1) / 2 + (sv + 1) / 2 + 1);
}
void Soviet() {
  for (int i = 1; i <= n; ++i) {
    if (D.Father[i] == i) {
      ans = -1;
      root = furthest = i;
      DFS(root, -1, 0);
      ans = -1;
      DFS(furthest, -1, 0);
      maxlen[i] = ans;
    }
  }
  for (int i = 1; i <= q; ++i) {
    int o;
    scanf("%d", &o);
    if (o == 2) {
      int u, v;
      scanf("%d%d", &u, &v);
      IntelligentMerge(u, v);
    } else if (o == 1) {
      int u;
      scanf("%d", &u);
      printf("%d\n", maxlen[D.Find(u)]);
    }
  }
}
void IsMyWife() {
  if (0) {
    freopen("", "r", stdin);
    freopen("", "w", stdout);
  }
  D.Init();
  G.clear();
  Input();
  Soviet();
}
};  // namespace Flandle_Scarlet
int main() {
  Flandle_Scarlet::IsMyWife();
  return 0;
}
