#include <bits/stdc++.h>
using namespace std;
const char IO_MODE = 0;
inline long long ReadInt() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void WriteInt(long long x) {
  char CH[20];
  int Num = 0;
  if (!x) {
    putchar('0');
    return;
  }
  while (x > 0) CH[++Num] = x % 10, x /= 10;
  while (Num) putchar(CH[Num--] + 48);
}
inline void out(int x) {
  if (IO_MODE & 1)
    WriteInt(x);
  else
    printf("%i", x);
}
template <typename... Args>
inline void out(int x, Args... args) {
  out(x);
  putc(' ', stdout);
  out(args...);
}
inline void in(int &x) {
  if (IO_MODE & 2)
    x = ReadInt();
  else
    scanf("%i", &x);
}
template <typename... Args>
inline void in(int &x, Args &...args) {
  in(x);
  in(args...);
}
inline void outll(long long x) {
  if (IO_MODE & 1)
    WriteInt(x);
  else
    printf("%I64d", x);
}
template <typename... Args>
inline void outll(long long x, Args... args) {
  outll(x);
  putc(' ', stdout);
  outll(args...);
}
inline void inll(long long &x) {
  if (IO_MODE & 2)
    x = ReadInt();
  else
    scanf("%I64d", &x);
}
template <typename... Args>
inline void inll(long long &x, Args &...args) {
  inll(x);
  inll(args...);
}
int aa, bb, cc, dd, ee, ff, gg, hh, ii, jj, kk, mm, nn, oo, pp, qq, rr, ss, tt,
    uu, vv, ww, xx, yy, zz;
int tc, ty;
class DSU {
 private:
  vector<int> P, Rank, SetSize;
  int NumDS;

 public:
  DSU(int n) {
    SetSize.assign(n, 1);
    Rank.assign(n, 0);
    P.assign(n, 0);
    NumDS = n;
    for (int i = 0; i < n; i++) P[i] = i;
  }
  void Rest() {
    int n = P.size();
    SetSize.assign(n, 1);
    Rank.assign(n, 0);
    P.assign(n, 0);
    NumDS = n;
    for (int i = 0; i < n; i++) P[i] = i;
  }
  void AddSet() {
    SetSize.push_back(1);
    Rank.push_back(0);
    P.push_back(P.size());
    NumDS++;
  }
  int FindSet(int x) { return P[x] == x ? x : P[x] = FindSet(P[x]); }
  bool isSameSet(int x, int y) { return FindSet(x) == FindSet(y); }
  void UnionSet(int x, int y) {
    if (!isSameSet(x, y)) {
      NumDS--;
      int X = FindSet(x);
      int Y = FindSet(y);
      if (Rank[X] > Rank[Y])
        P[Y] = X, SetSize[X] += SetSize[Y];
      else
        P[X] = Y, SetSize[Y] += SetSize[X], Rank[Y] += Rank[X] == Rank[Y];
    }
  }
  int NumOfDS() { return NumDS; }
  int SizeOfSet(int x) { return SetSize[FindSet(x)]; }
};
int n, m, q;
int vis[300100];
vector<vector<int>> adjList;
map<int, int> mp;
pair<int, int> diameter(int u, int parent) {
  vis[u] = 1;
  int d = 0;
  int mxh1 = -1;
  int mxh2 = -1;
  for (auto v : adjList[u])
    if (v != parent) {
      pair<int, int> ret = diameter(v, u);
      if (ret.second > mxh1) {
        swap(mxh1, mxh2);
        swap(ret.second, mxh1);
      } else if (ret.second > mxh2) {
        swap(ret.second, mxh2);
      }
      d = max(d, ret.first);
    }
  return make_pair(max(d, mxh1 + mxh2 + 2), mxh1 + 1);
}
int main() {
  in(n, m, q);
  adjList.resize(n);
  DSU dsu(n);
  while (m--) {
    in(uu, vv);
    uu--;
    vv--;
    adjList[uu].push_back(vv);
    adjList[vv].push_back(uu);
    dsu.UnionSet(uu, vv);
  }
  for (int u = 0; u < n; u++) {
    if (!vis[u]) {
      mp[dsu.FindSet(u)] = diameter(u, -1).first;
    }
  }
  while (q--) {
    if (ReadInt() & 1) {
      cout << mp[dsu.FindSet(ReadInt() - 1)] << endl;
    } else {
      in(uu, vv);
      uu--;
      vv--;
      if (dsu.isSameSet(uu, vv)) continue;
      int d1 = mp[dsu.FindSet(uu)];
      int d2 = mp[dsu.FindSet(vv)];
      dsu.UnionSet(uu, vv);
      mp[dsu.FindSet(uu)] = max({d1, d2, (d1 + 1) / 2 + (d2 + 1) / 2 + 1});
    }
  }
}
