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7
2 9 1
2 9 2
 10 5 6
1 2
2 3
2 4
4 5
1 6
2 3 1
2 6 4
2 1 1
1 5
1 6
1 4
 10 6 7
1 2
2 3
1 4
3 5
1 6
5 7
1 1
2 8 10
1 10
2 9 5
1 7
1 4
2 1 9
 100 16 46
36 42
36 50
42 54
42 74
50 58
42 16
50 81
50 96
42 62
54 2
74 75
74 22
2 48
50 95
74 66
75 5
1 62
1 56
2 6 68
1 47
1 43
1 38
1 75
2 22 82
2 56 77
1 71
2 52 15
2 9 1
2 12 59
1 24
2 41 94
2 18 58
2 22 67
1 45
2 68 70
1 81
1 48
1 71
2 76 28
2 31 73
2 58 80
2 100 57
2 88 79
1 30
2 96 23
2 92 44
1 12
1 66
1 24
2 71 68
2 4 4
2 84 43
2 80 15
2 54 13
1 51
2 99 17
1 63
2 12 41
2 1 2
2 62 96
2 79 9
2 59 79
 10 1 9
1 2
1 5
2 7 4
1 4
1 7
2 2 5
2 6 3
1 3
1 4
1 2
 10 5 77
1 2
1 3
3 4
1 5
5 6
1 2
2 3 10
2 5 1
1 2
1 4
2 7 7
2 7 9
1 7
2 4 9
2 2 4
2 3 2
2 5 2
2 10 1
2 3 8
1 9
1 4
1 2
2 8 3
2 8 2
2 2 3
2 5 9
1 10
2 3 10
2 5 9
1 2
1 7
1 4
1 4
1 3
1 4
1 10
2 8 7
1 2
2 3 1
1 10
2 7 7
1 2
1 5
1 3
1 8
2 7 7
1 10
2 4 2
1 9
2 6 6
1 3
1 2
2 8 10
1 1
1 7
2 10 7
1 8
1 9
2 1 4
2 1 1
2 3 3
1 9
1 8
2 9 4
1 4
2 4 4
1 6
2 9 4
2 5 10
1 4
2 8 9
1 10
1 4
1 4
1 10
1 2
1 4
1 7
2 10 8
1 2
2 6 6
2 8 5
 10 4 46
1 2
2 3
1 4
2 5
1 5
1 9
2 6 8
2 10 8
1 1
1 5
1 1
2 6 6
1 8
2 9 3
1 2
1 5
1 2
2 6 5
1 2
1 6
2 5 3
1 5
2 10 5
1 5
2 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>
#include <algorithm>

#define INPUT "c.in"

#define INF INT_MAX

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<int, ii> iii;
typedef vector<iii> viii;
typedef vector<bool> vb;
typedef unsigned long ulong;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define contains(c,x) ((c).find(x) != (c).end())
#define forr(i,A,B) for(int i = A;i<B;i++)
#define iii(A,B,C) iii(A,ii(B,C))
#define max3(A,B,C) max((A),max((B),(C)))
#define max4(A,B,C,D) max(max((A),(B)),max((C),(D)))
#define max5(A,B,C,D,E) max(max(A,B),max3(C,D,E))
#define max6(A,B,C,D,E,F) max3(max(A,B),max(C,D),max(E,F))
#define divc2(A) ((A)/2+(A%2==0?0:1))
#define dprintf if(DEBUG)printf
#define a3 .first
#define b3 .second.first
#define c3 .second.second
#define printnum(A) if(A>=INF)cout<<"INF\t";else cout<<A<<"\t"
template <class myType1, class myType2> ostream &operator << (ostream &out, const pair<myType1, myType2>&object){ out << object.first << ' ' << object.second; return out; }
template <class myType> istream &operator >> (istream &in, vector<myType> &object){ myType c; cin >> c; object.pb(c); return in; }
//template <class myType> istream &operator >> (istream &in, vector<myType> &object){myType c;std::string line;std::getline(in, line);std::istringstream iss(line);while ( iss >> c) {object.push_back(c);}return in;}
template <class myType> istream &operator >> (istream &in, myType object[]){ scanf(" "); myType c; std::string line; std::getline(in, line); std::istringstream iss(line); int ind = 0; while (iss >> c) { object[ind] = c; ind++; }return in; }
template <class myType1, class myType2>istream &operator >> (istream &in, pair<myType1, myType2> &object){ in >> object.first >> object.second; return in; }
template <class myType> void fill(myType container[], myType val, int len){ forr(i, 0, len){ container[i] = val; } }
template <class myType> myType operator % (pair<myType, pair<myType, myType> >& a, int b){ switch (b){ case 0:return a.first; case 1:return a.second.first; case 2:return a.second.second; } }
template <class myType> myType operator % (pair<myType, myType>& a, int b){ switch (b){ case 0:return a.first; case 1:return a.second; } }
inline ii sorted(ii a){ return ii(min(a % 0, a % 1), max(a % 0, a % 1)); }
template <class myType> myType fastpow(register myType a, register ull b){ register myType result = 1; while (b){ if (b & 1){ result *= a; }b >>= 1; a *= a; }return result; }
#undef DEBUG
int _main(); bool DEBUG; int main(int argc, char *argv[]){ if (argc >= 2 && strcmp("DEBUG", argv[1]) == 0)DEBUG = true; return _main(); }


int N, M, Q;
vector<bool> vis, vis2;
int parent[455555];
int lenp[455555];
int ramk[455555];
vi G[455555];

int findparent(int start)
{
    if(parent[start]!=start)
        parent[start]=findparent(parent[start]);
    return parent[start];
}
int unite(int a,int b){
    int pa=findparent(a);
    int pb=findparent(b);
    if(ramk[pa]<ramk[pb])
        parent[pa]=pb;
    else if(ramk[pb]<ramk[pa])
        parent[pb]=pa;
    else{
        parent[pb]=pa;
        ramk[pa]++;
    }
    return findparent(pa);
}

int findfars(int start)
{
    queue<int> mq;
    mq.push(start);
    
    int lastpop = -1;
    
    while(!mq.empty())
    {
        int cur = mq.front();
        mq.pop();
        
        lastpop = cur;

        //dprintf("%d %d\n", start+1, cur+1);

        unite(start,cur);
        vis[cur] = true;

        forr(i, 0, G[cur].size())
        {
            if (vis[G[cur][i]])
                continue;
            mq.push(G[cur][i]);
        }
        
        
    }


    return lastpop;
}

int findlen(int start)
{
    queue<ii> mq;
    mq.push(ii(0, start));
    
    ii lastpop(-1,-1);

    while(!mq.empty())
    {
        ii curii = mq.front();
        mq.pop();
        
        lastpop = curii;

        int cur = curii % 1;
        int len = curii % 0;
        
        //dprintf("l%d %d\n", start+1, cur+1);

        unite(start,cur);
        vis2[cur] = true;

        forr(i, 0, G[cur].size())
        {
            if (vis2[G[cur][i]])
                continue;
            mq.push(ii(len + 1, G[cur][i]));
        }

    }


    return lastpop % 0;
}




void readgraph()
{
    forr(i, 0, M)
    {
        int from, to;
        cin >> from >> to;
        from--;
        to--;

        G[from].pb(to);
        G[to].pb(from);
    }
}


int _main()
{
    //freopen("C:\\Users\\Hasan Altan Birler\\OneDrive\\mp\\codeforces\\455\\c.in", "r", stdin);
    cin >> N >> M >> Q;

    readgraph();

    vis = vector<bool>(455555);
    vis2 = vector<bool>(455555);

    forr(i, 0, N)
    {
        parent[i] = i;
        lenp[i] = 0;
        ramk[i]=1;
    }
    forr(i, 0, N)
    {
        if (vis[i] == true)
            continue;

        //dprintf("--%d\n", i+1);

        int far = findfars(i);
        int len = findlen(far);

        lenp[far] = len;
    }

    forr(i, 0, Q)
    {
        int type;
        cin >> type;


        if (type == 1)
        {
            int node;
            cin >> node;
            node--;

            int maxlen = lenp[findparent(node)];
            

            cout << maxlen << endl;
        }
        else if (type == 2)
        {
            int node1, node2;
            cin >> node1 >> node2;
            node1--;
            node2--;

            int par1 = findparent(node1);
            int par2 = findparent(node2);
            
            if (par1 == par2)
                continue;

            if (lenp[par1]<lenp[par2])
            {
                swap(par1, par2);
                swap(node1,node2);
            }

            int len1 = lenp[par1];
            int len2 = lenp[par2];

            int h1 = divc2(len1);
            int h2 = divc2(len2);

           par1=unite(par1,par2);
            
            //printf("n%d n%d p%d p%d l%d l%d h%d h%d\n",node1+1,node2+1,par1+1,par2+1,len1,len2,h1,h2);

            int newlen = max(len1, h1 + h2 + 1);

            lenp[par1] = newlen;
        }
    }


    return 0;
}