#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T poww(T b, T p) {
  long long a = 1;
  while (p) {
    if (p & 1) {
      a = (a * b);
    }
    p >>= 1;
    b = (b * b);
  }
  return a;
}
template <class T>
inline T poww2(T b, int p) {
  T a = 1;
  while (p) {
    if (p & 1) {
      a = (a * b);
    }
    p >>= 1;
    b = (b * b);
  }
  return a;
}
template <class T>
inline T modpoww(T b, T p, T mmod) {
  long long a = 1;
  while (p) {
    if (p & 1) {
      a = (a * b) % mmod;
    }
    p >>= 1;
    b = (b * b) % mmod;
  }
  return a % mmod;
}
template <class T>
inline T gcd(T a, T b) {
  if (b > a) return gcd(b, a);
  return ((b == 0) ? a : gcd(b, a % b));
}
template <class T>
inline void scan(vector<T>& a, int n) {
  T b;
  int i;
  for ((i) = 0; (i) < (n); (i) += 1) {
    cin >> b;
    a.push_back(b);
  }
}
inline void scand(vector<int>& a, int n) {
  int b;
  int i;
  for ((i) = 0; (i) < (n); (i) += 1) {
    scanf("%d", &(b));
    a.push_back(b);
  }
}
int n, m, q;
int ct = 1;
vector<int> par;
int diameter[300010];
vector<vector<int> > a;
pair<int, int> bfs(int k, vector<int>& fl, int ty) {
  int i, j, mx = -1000000007;
  queue<pair<int, int> > q;
  pair<int, int> ans;
  q.push(make_pair(k, 0));
  if (!ty) par[k] = k;
  fl[k] = 1;
  while (q.size()) {
    int t = q.front().first;
    int d = q.front().second;
    if (d > mx) {
      mx = d;
      ans = q.front();
    }
    q.pop();
    for ((i) = 0; (i) < (a[t].size()); (i) += 1) {
      j = a[t][i];
      if (fl[j] == 0) {
        q.push(make_pair(j, d + 1));
        fl[j] = 1;
        if (!ty) par[j] = k;
      }
    }
  }
  return ans;
}
void get_diameter(int k, vector<int>& fl, vector<int>& fl2) {
  int i, j, p, q, r;
  diameter[k] = bfs(bfs(k, fl2, 0).first, fl, 1).second;
}
int parent(int x) {
  if (par[x] != x) {
    par[x] = parent(par[x]);
  }
  return par[x];
}
void merge(int a, int b) {
  par[b] = par[a];
  diameter[a] = max(max(diameter[a], diameter[b]),
                    (diameter[a] + 1) / 2 + (diameter[b] + 1) / 2 + 1);
}
int main() {
  int i, j, k, x, y;
  cin >> n >> m >> q;
  a.resize(n + 2);
  par.resize(n + 2);
  for ((i) = 0; (i) < (m); (i) += 1) {
    scanf("%d", &(j));
    scanf("%d", &(k));
    a[j].push_back(k);
    a[k].push_back(j);
  }
  vector<int> fl(n + 1, 0);
  vector<int> fl2(n + 1, 0);
  for ((i) = (1); (i) < (n + 1); (i) += 1) {
    if (fl[i] == 0) {
      get_diameter(i, fl, fl2);
    }
  }
  int t;
  for ((i) = 0; (i) < (q); (i) += 1) {
    scanf("%d", &(t));
    if (t == 1) {
      scanf("%d", &(x));
      cout << diameter[parent(x)] << "\n";
    } else {
      scanf("%d", &(x));
      scanf("%d", &(y));
      if (parent(x) != parent(y)) merge(parent(x), parent(y));
    }
  }
  return 0;
}
