#include <bits/stdc++.h>
using namespace std;
#define Maxn 200007
int T,n,m,k;
int last[Maxn],pre[Maxn],other[Maxn],cnt=0,d[Maxn];
int sz;
set<pair<int,int> >s;
unordered_map<long long,bool> mp;
int que[Maxn],tot;
void insert(int u,int v)
{
    other[++cnt]=v,pre[cnt]=last[u],last[u]=cnt;
}
bool check(int u,int v)
{
    if (mp.find(1LL*n*u+v)!=mp.end()) return true;
    if (mp.find(1LL*n*v+u)!=mp.end()) return true;
    return false;
}
void solve()
{
    scanf("%d%d%d",&n,&m,&k);
    for (int i=1;i<=n;i++)
        last[i]=0,d[i]=0;
    mp.clear();
    s.clear();
    cnt=0;
    for (int i=1;i<=m;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        mp[1LL*n*u+v]=true;
        mp[1LL*n*v+u]=true;
        insert(u,v),insert(v,u);
        ++d[u],++d[v];
    }
    for (int i=1;i<=n;i++)
        s.insert(make_pair(d[i],i));
    sz=n;
    if ((1LL*k*(k-1))/2>m)
    {
        printf("%d\n",-1);
        return;
    }
    while (sz>0&&(*s.begin()).first<k-1)
    {
        int u=(*s.begin()).second;
        s.erase(s.begin());
        --sz;
        for (int q=last[u];q;q=pre[q])
        {
            int v=other[q];
            --d[u];
            --d[v];
            s.erase(make_pair(d[v]+1,v));
            s.insert(make_pair(d[v],v));
        }
    }
    while (sz>0&&(*s.begin()).first<=k-1)
    {
        if ((*s.begin()).first<k-1)
        {
            int u=(*s.begin()).second;
            s.erase(s.begin());
            --sz;
            for (int q=last[u];q;q=pre[q])
            {
                int v=other[q];
                --d[u];
                --d[v];
                s.erase(make_pair(d[v]+1,v));
                s.insert(make_pair(d[v],v));
            }
        } else
        {
            int u=(*s.begin()).second;
            tot=1;
            que[1]=u;
            for (int q=last[u];q;q=pre[q])
            {
                int v=other[q];
                que[++tot]=v;
            }
            random_shuffle(que+1,que+tot+1);
            bool flag=true;
            for (int i=1;i<=tot&&flag;i++)
                for (int j=i+1;j<=tot&&flag;j++)
                    if (!check(que[i],que[j]))
                    {
                        flag=false;
                        break;
                    }
            if (flag)
            {
                printf("%d\n",2);
                for (int i=1;i<=tot;i++)
                    printf("%d ",que[i]);
                printf("\n");
                return;
            } else
            {
                s.erase(s.begin());
                --sz;
                for (int q=last[u];q;q=pre[q])
                {
                    int v=other[q];
                    --d[u];
                    --d[v];
                    s.erase(make_pair(d[v]+1,v));
                    s.insert(make_pair(d[v],v));
                }
            }
        }
    }
    if (sz>0)
    {
        printf("%d %d\n",1,sz);
        for (set<pair<int,int> >::iterator it=s.begin();it!=s.end();it++)
            printf("%d ",(*it).second);
        printf("\n");
    } else printf("%d\n",-1);
}
int main()
{
    scanf("%d",&T);
    while (T--) solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define Maxn 200007
int T,n,m,k;
int last[Maxn],pre[Maxn],other[Maxn],cnt=0,d[Maxn];
int sz;
set<pair<int,int> >s;
unordered_map<long long,bool> mp;
bool vis[Maxn];
int que[Maxn],tot;
void insert(int u,int v)
{
    other[++cnt]=v,pre[cnt]=last[u],last[u]=cnt;
}
bool check(int u,int v)
{
    if (mp.find(1LL*n*u+v)!=mp.end()) return true;
    if (mp.find(1LL*n*v+u)!=mp.end()) return true;
    return false;
}
void solve()
{
    scanf("%d%d%d",&n,&m,&k);
    for (int i=1;i<=n;i++)
        last[i]=0,d[i]=0,vis[i]=false;
    mp.clear();
    s.clear();
    cnt=0;
    for (int i=1;i<=m;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        mp[1LL*n*u+v]=true;
        mp[1LL*n*v+u]=true;
        insert(u,v),insert(v,u);
        ++d[u],++d[v];
    }
    for (int i=1;i<=n;i++)
        s.insert(make_pair(d[i],i));
    sz=n;
    if ((1LL*k*(k-1))/2>m)
    {
        printf("%d\n",-1);
        return;
    }
    while (sz>0&&(*s.begin()).first<=k-1)
    {
        if ((*s.begin()).first<k-1)
        {
            int u=(*s.begin()).second;
            s.erase(s.begin());
            vis[u]=true;
            --sz;
            for (int q=last[u];q;q=pre[q])
            {
                int v=other[q];
                if (vis[v]) continue;
                --d[u];
                --d[v];
                s.erase(make_pair(d[v]+1,v));
                s.insert(make_pair(d[v],v));
            }
        } else
        {
            int u=(*s.begin()).second;
            tot=1;
            que[1]=u;
            for (int q=last[u];q;q=pre[q])
            {
                int v=other[q];
                if (!vis[v]) que[++tot]=v;
            }
            random_shuffle(que+1,que+tot+1);
            bool flag=true;
            for (int i=1;i<=tot&&flag;i++)
                for (int j=i+1;j<=tot&&flag;j++)
                    if (!check(que[i],que[j]))
                    {
                        flag=false;
                        break;
                    }
            if (flag)
            {
                printf("%d\n",2);
                for (int i=1;i<=tot;i++)
                    printf("%d ",que[i]);
                printf("\n");
                return;
            } else
            {
                vis[u]=true;
                s.erase(s.begin());
                --sz;
                for (int q=last[u];q;q=pre[q])
                {
                    int v=other[q];
                    if (vis[v]) continue;
                    --d[u];
                    --d[v];
                    s.erase(make_pair(d[v]+1,v));
                    s.insert(make_pair(d[v],v));
                }
            }
        }
    }
    if (sz>0)
    {
        printf("%d %d\n",1,sz);
        for (set<pair<int,int> >::iterator it=s.begin();it!=s.end();it++)
            printf("%d ",(*it).second);
        printf("\n");
    } else printf("%d\n",-1);
}
int main()
{
    scanf("%d",&T);
    while (T--) solve();
    return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<iostream>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,a,b) for (int i=a;i<b;i++)
#define dep(i,a,b) for (int i=a;i>=b;i--)
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int>pii;
typedef double db;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int mod = 998244353;
const int N = 2e5+6;
gp_hash_table<int, int> h[N];
vi e[N];
int cnt[N];
int solve(const vi &v){
    rep(j, 0, sz(v)){
        int x = v[j];
        rep(l, j + 1, sz(v)){
            int y = v[l];
            if(h[x].find(y) == h[x].end())
                return 0;
        }
    }
    return 1;
}
int main() {
    int T;
    scanf("%d", &T);
    while(T--){
        int n, m, k;
        scanf("%d%d%d", &n, &m, &k);
        rep(i, 1, n + 1) {
            h[i].clear();
            e[i].clear();
            cnt[i] = 0;
        }
        rep(i, 1, m + 1){
            int x, y;
            scanf("%d%d", &x, &y);
            e[x].pb(y); e[y].pb(x);
            cnt[x]++;  cnt[y]++;
            h[x][y] = 1;
            h[y][x] = 1;
        }
        vi v;
        rep(i, 1, n + 1) if(cnt[i] < k - 1)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            for(auto u:e[x]){
                cnt[u]--;
                if(cnt[u] == k - 2)
                    v.pb(u);
            }
        }
        int f = 0;
        rep(i, 1, n + 1) if(cnt[i] == k - 1){
            vi v = e[i];
            v.pb(i);
            if(solve(v)){
                printf("2\n");
                rep(i, 0, sz(v)){
                    printf("%d%c", v[i], " \n"[i==sz(v)-1]);
                }
                f = 1;
                break;
            }
        }
        if(f) continue;
        v.clear();
        rep(i, 1, n + 1) if(cnt[i] < k)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            for(auto u:e[x]){
                cnt[u]--;
                if(cnt[u] == k - 1)
                    v.pb(u);
            }
        }
        vi ans;
        rep(i, 1, n + 1) if(cnt[i] >= k){
            ans.pb(i);
        }
        if(!sz(ans)) printf("-1\n");
        else {
            printf("1 %d\n", sz(ans));
            rep(i, 0, sz(ans)){
                printf("%d%c", ans[i], " \n"[i==sz(ans)-1]);
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<iostream>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,a,b) for (int i=a;i<b;i++)
#define dep(i,a,b) for (int i=a;i>=b;i--)
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int>pii;
typedef double db;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int mod = 998244353;
const int N = 2e5+6;
gp_hash_table<int, int> h[N];
vi e[N];
int cnt[N], vis[N];
int solve(const vi &v){
    rep(j, 0, sz(v)){
        int x = v[j];
        rep(l, j + 1, sz(v)){
            int y = v[l];
            if(h[x].find(y) == h[x].end())
                return 0;
        }
    }
    return 1;
}
int main() {
    int T;
    scanf("%d", &T);
    while(T--){
        int n, m, k;
        scanf("%d%d%d", &n, &m, &k);
        rep(i, 1, n + 1) {
            h[i].clear();
            e[i].clear();
            cnt[i] = 0;
            vis[i] = 1;
        }
        rep(i, 1, m + 1){
            int x, y;
            scanf("%d%d", &x, &y);
            e[x].pb(y); e[y].pb(x);
            cnt[x]++;  cnt[y]++;
            h[x][y] = 1;
            h[y][x] = 1;
        }
        vi v;
        rep(i, 1, n + 1) if(cnt[i] < k - 1)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            vis[x] = 0;
            for(auto u:e[x]){
                cnt[u]--;
                if(cnt[u] == k - 2)
                    v.pb(u);
            }
        }
        int f = 0;
        rep(i, 1, n + 1) if(cnt[i] >= k - 1){
            vi v;
            v.pb(i);
            for(auto u:e[i])
                if(vis[u]) v.pb(u);
            if(solve(v)){
                printf("2\n");
                rep(i, 0, sz(v)){
                    printf("%d%c", v[i], " \n"[i==sz(v)-1]);
                }
                f = 1;
                break;
            }
        }
        if(f) continue;
        v.clear();
        rep(i, 1, n + 1) if(cnt[i] < k)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            for(auto u:e[x]){
                cnt[u]--;
                if(cnt[u] == k - 1)
                    v.pb(u);
            }
        }
        vi ans;
        rep(i, 1, n + 1) if(cnt[i] >= k){
            ans.pb(i);
        }
        if(!sz(ans)) printf("-1\n");
        else {
            printf("1 %d\n", sz(ans));
            rep(i, 0, sz(ans)){
                printf("%d%c", ans[i], " \n"[i==sz(ans)-1]);
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<iostream>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,a,b) for (int i=a;i<b;i++)
#define dep(i,a,b) for (int i=a;i>=b;i--)
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int>pii;
typedef double db;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int mod = 998244353;
const int N = 2e5+6;
gp_hash_table<int, int> h[N];
vi e[N];
int cnt[N], vis[N], p[N];
int solve(const vi &v){
    rep(j, 0, sz(v)){
        int x = v[j];
        rep(l, j + 1, sz(v)){
            int y = v[l];
            if(h[x].find(y) == h[x].end())
                return 0;
        }
    }
    return 1;
}
bool cmp(int a,int b){
    return cnt[a] < cnt[b];
}
int main() {
    int T;
    scanf("%d", &T);
    while(T--){
        int n, m, k;
        scanf("%d%d%d", &n, &m, &k);
        rep(i, 1, n + 1) {
            h[i].clear();
            e[i].clear();
            cnt[i] = 0;
            vis[i] = 1;
        }
        rep(i, 1, m + 1){
            int x, y;
            scanf("%d%d", &x, &y);
            e[x].pb(y); e[y].pb(x);
            cnt[x]++;  cnt[y]++;
            h[x][y] = 1;
            h[y][x] = 1;
        }
        vi v;
        rep(i, 1, n + 1) if(cnt[i] < k - 1)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            vis[x] = 0;
            for(auto u:e[x]) if(vis[u]){
                cnt[u]--;
                if(cnt[u] == k - 2)
                    v.pb(u);
            }
        }
        int f = 0;
        queue<int > q;
        rep(i, 1, n + 1)if(vis[i] && cnt[i] == k - 1)
            q.push(i);
        while(sz(q)){
            int x = q.front();
            q.pop();
            vi v;
            v.pb(x);
            for(auto u:e[x])
                if(vis[u]) v.pb(u);
            if(sz(v) == k && solve(v)){
                printf("2\n");
                rep(i, 0, sz(v)){
                    printf("%d%c", v[i], " \n"[i==sz(v)-1]);
                }
                f = 1;
                break;
            }
            vis[x] = 0;
            for(auto u:e[x]){
                cnt[u]--;
                if(vis[u] && cnt[u] == k - 1){
                    q.push(u);
                }
            }
        }
        if(f) continue;
        v.clear();
        rep(i, 1, n + 1) if(cnt[i] < k && vis[i])
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            for(auto u:e[x]) {
                cnt[u]--;
                if(cnt[u] == k - 1)
                    v.pb(u);
            }
        }
        vi ans;
       // rep(i, 1, n + 1) dd(i), de(cnt[i]);
        rep(i, 1, n + 1) if(cnt[i] >= k){
            ans.pb(i);
        }
        if(!sz(ans)) printf("-1\n");
        else {
            printf("1 %d\n", sz(ans));
            rep(i, 0, sz(ans)){
                printf("%d%c", ans[i], " \n"[i==sz(ans)-1]);
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<iostream>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,a,b) for (int i=a;i<b;i++)
#define dep(i,a,b) for (int i=a;i>=b;i--)
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int>pii;
typedef double db;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int mod = 998244353;
const int N = 2e5+6;
gp_hash_table<int, int> h[N];
vi e[N];
int cnt[N], vis[N];
int solve(const vi &v){
    rep(j, 0, sz(v)){
        int x = v[j];
        rep(l, j + 1, sz(v)){
            int y = v[l];
            if(h[x].find(y) == h[x].end())
                return 0;
        }
    }
    return 1;
}
int main() {
    int T;
    scanf("%d", &T);
    while(T--){
        int n, m, k;
        scanf("%d%d%d", &n, &m, &k);
        rep(i, 1, n + 1) {
            h[i].clear();
            e[i].clear();
            cnt[i] = 0;
            vis[i] = 1;
        }
        rep(i, 1, m + 1){
            int x, y;
            scanf("%d%d", &x, &y);
            e[x].pb(y); e[y].pb(x);
            cnt[x]++;  cnt[y]++;
            h[x][y] = 1;
            h[y][x] = 1;
        }
        vi v;
        rep(i, 1, n + 1) if(cnt[i] < k - 1)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            vis[x] = 0;
            for(auto u:e[x]){
                cnt[u]--;
                if(cnt[u] == k - 2)
                    v.pb(u);
            }
        }
        int f = 0;
        rep(i, 1, n + 1) if(cnt[i] == k - 1){
            vi v;
            v.pb(i);
            for(auto u:e[i])
                if(vis[u]) v.pb(u);
            if(solve(v)){
                printf("2\n");
                rep(i, 0, sz(v)){
                    printf("%d%c", v[i], " \n"[i==sz(v)-1]);
                }
                f = 1;
                break;
            }
        }
        if(f) continue;
        v.clear();
        rep(i, 1, n + 1) if(cnt[i] < k)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            for(auto u:e[x]){
                cnt[u]--;
                if(cnt[u] == k - 1)
                    v.pb(u);
            }
        }
        vi ans;
        rep(i, 1, n + 1) if(cnt[i] >= k){
            ans.pb(i);
        }
        if(!sz(ans)) printf("-1\n");
        else {
            printf("1 %d\n", sz(ans));
            rep(i, 0, sz(ans)){
                printf("%d%c", ans[i], " \n"[i==sz(ans)-1]);
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<iostream>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,a,b) for (int i=a;i<b;i++)
#define dep(i,a,b) for (int i=a;i>=b;i--)
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int>pii;
typedef double db;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int mod = 998244353;
const int N = 2e5+6;
gp_hash_table<int, int> h[N];
vi e[N];
int cnt[N], vis[N], p[N];
int solve(const vi &v){
    rep(j, 0, sz(v)){
        int x = v[j];
        rep(l, j + 1, sz(v)){
            int y = v[l];
            if(h[x].find(y) == h[x].end())
                return 0;
        }
    }
    return 1;
}
bool cmp(int a,int b){
    return cnt[a] < cnt[b];
}
int main() {
    int T;
    scanf("%d", &T);
    while(T--){
        int n, m, k;
        scanf("%d%d%d", &n, &m, &k);
        rep(i, 1, n + 1) {
            h[i].clear();
            e[i].clear();
            cnt[i] = 0;
            vis[i] = 1;
        }
        rep(i, 1, m + 1){
            int x, y;
            scanf("%d%d", &x, &y);
            e[x].pb(y); e[y].pb(x);
            cnt[x]++;  cnt[y]++;
            h[x][y] = 1;
            h[y][x] = 1;
        }
        vi v;
        rep(i, 1, n + 1) if(cnt[i] < k - 1)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            vis[x] = 0;
            for(auto u:e[x]) if(vis[u]){
                cnt[u]--;
                if(cnt[u] == k - 2)
                    v.pb(u);
            }
        }
        int f = 0;
        queue<int > q;
        rep(i, 1, n + 1)if(vis[i] && cnt[i] == k - 1)
            q.push(i);
        while(sz(q)){
            int x = q.front();
            q.pop();
            vi v;
            v.pb(x);
            for(auto u:e[x])
                if(vis[u]) v.pb(u);
            if(sz(v) == k && solve(v)){
                printf("2\n");
                rep(i, 0, sz(v)){
                    printf("%d%c", v[i], " \n"[i==sz(v)-1]);
                }
                f = 1;
                break;
            }
            vis[x] = 0;
            for(auto u:e[x]){
                cnt[u]--;
                if(vis[u] && cnt[u] == k - 1){
                    q.push(u);
                }
            }
        }
        if(f) continue;
        v.clear();
        rep(i, 1, n + 1) if(cnt[i] < k)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            for(auto u:e[x]) {
                cnt[u]--;
                if(cnt[u] == k - 1)
                    v.pb(u);
            }
        }
        vi ans;
       // rep(i, 1, n + 1) dd(i), de(cnt[i]);
        rep(i, 1, n + 1) if(cnt[i] >= k){
            ans.pb(i);
        }
        if(!sz(ans)) printf("-1\n");
        else {
            printf("1 %d\n", sz(ans));
            rep(i, 0, sz(ans)){
                printf("%d%c", ans[i], " \n"[i==sz(ans)-1]);
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<iostream>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,a,b) for (int i=a;i<b;i++)
#define dep(i,a,b) for (int i=a;i>=b;i--)
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int>pii;
typedef double db;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int mod = 998244353;
const int N = 2e5+6;
gp_hash_table<int, int> h[N];
vi e[N];
int cnt[N], vis[N], p[N];
int solve(const vi &v){
    rep(j, 0, sz(v)){
        int x = v[j];
        rep(l, j + 1, sz(v)){
            int y = v[l];
            if(h[x].find(y) == h[x].end())
                return 0;
        }
    }
    return 1;
}
bool cmp(int a,int b){
    return cnt[a] < cnt[b];
}
int main() {
    int T;
    scanf("%d", &T);
    while(T--){
        int n, m, k;
        scanf("%d%d%d", &n, &m, &k);
        rep(i, 1, n + 1) {
            h[i].clear();
            e[i].clear();
            cnt[i] = 0;
            vis[i] = 1;
        }
        rep(i, 1, m + 1){
            int x, y;
            scanf("%d%d", &x, &y);
            e[x].pb(y); e[y].pb(x);
            cnt[x]++;  cnt[y]++;
            h[x][y] = 1;
            h[y][x] = 1;
        }
        vi v;
        rep(i, 1, n + 1) if(cnt[i] < k - 1)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            vis[x] = 0;
            for(auto u:e[x]){
                cnt[u]--;
                if(cnt[u] == k - 2)
                    v.pb(u);
            }
        }
        int f = 0;
        rep(i, 1, n + 1) p[i] = i;
        sort(p + 1, p + n + 1, cmp);
        rep(i, 1, n + 1) if(cnt[p[i]] >= k - 1){
            vi v;
            int x = p[i];
            v.pb(x);
            for(auto u:e[x])
                if(vis[u]) v.pb(u);
            if(sz(v) == k && solve(v)){
                printf("2\n");
                rep(i, 0, sz(v)){
                    printf("%d%c", v[i], " \n"[i==sz(v)-1]);
                }
                f = 1;
                break;
            }
            vis[x] = 0;
        }
        if(f) continue;
        v.clear();
        rep(i, 1, n + 1) if(cnt[i] < k)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            for(auto u:e[x]){
                cnt[u]--;
                if(cnt[u] == k - 1)
                    v.pb(u);
            }
        }
        vi ans;
        rep(i, 1, n + 1) if(cnt[i] >= k){
            ans.pb(i);
        }
        if(!sz(ans)) printf("-1\n");
        else {
            printf("1 %d\n", sz(ans));
            rep(i, 0, sz(ans)){
                printf("%d%c", ans[i], " \n"[i==sz(ans)-1]);
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<iostream>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,a,b) for (int i=a;i<b;i++)
#define dep(i,a,b) for (int i=a;i>=b;i--)
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int>pii;
typedef double db;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int mod = 998244353;
const int N = 2e5+6;
gp_hash_table<int, int> h[N];
vi e[N];
int cnt[N], vis[N], p[N];
int solve(const vi &v){
    rep(j, 0, sz(v)){
        int x = v[j];
        rep(l, j + 1, sz(v)){
            int y = v[l];
            if(h[x].find(y) == h[x].end())
                return 0;
        }
    }
    return 1;
}
bool cmp(int a,int b){
    return cnt[a] < cnt[b];
}
int main() {
    int T;
    scanf("%d", &T);
    while(T--){
        int n, m, k;
        scanf("%d%d%d", &n, &m, &k);
        rep(i, 1, n + 1) {
            h[i].clear();
            e[i].clear();
            cnt[i] = 0;
            vis[i] = 1;
        }
        rep(i, 1, m + 1){
            int x, y;
            scanf("%d%d", &x, &y);
            e[x].pb(y); e[y].pb(x);
            cnt[x]++;  cnt[y]++;
            h[x][y] = 1;
            h[y][x] = 1;
        }
        vi v;
        rep(i, 1, n + 1) if(cnt[i] < k - 1)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            vis[x] = 0;
            for(auto u:e[x]) if(vis[u]){
                cnt[u]--;
                if(cnt[u] == k - 2)
                    v.pb(u);
            }
        }
        int f = 0;
        queue<int > q;
        rep(i, 1, n + 1)if(vis[i] && cnt[i] == k - 1)
            q.push(i);
        while(sz(q)){
            int x = q.front();
            q.pop();
            vi v;
            v.pb(x);
            for(auto u:e[x])
                if(vis[u]) v.pb(u);
            if(sz(v) == k && solve(v)){
                printf("2\n");
                rep(i, 0, sz(v)){
                    printf("%d%c", v[i], " \n"[i==sz(v)-1]);
                }
                f = 1;
                break;
            }
            vis[x] = 0;
            for(auto u:e[x]){
                cnt[u]--;
                if(vis[u] && cnt[u] == k - 1){
                    q.push(u);
                }
            }
        }
        if(f) continue;
        v.clear();
        rep(i, 1, n + 1) if(cnt[i] < k && vis[i])
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            vis[x] = 0;
            for(auto u:e[x]) if(vis[u]){
                cnt[u]--;
                if(vis[u] && cnt[u] == k - 1)
                    v.pb(u);
            }
        }
        vi ans;
       // rep(i, 1, n + 1) dd(i), de(cnt[i]);
        rep(i, 1, n + 1) if(vis[i] && cnt[i] >= k){
            ans.pb(i);
        }
        if(!sz(ans)) printf("-1\n");
        else {
            printf("1 %d\n", sz(ans));
            rep(i, 0, sz(ans)){
                printf("%d%c", ans[i], " \n"[i==sz(ans)-1]);
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<iostream>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,a,b) for (int i=a;i<b;i++)
#define dep(i,a,b) for (int i=a;i>=b;i--)
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int>pii;
typedef double db;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int mod = 998244353;
const int N = 2e5+6;
gp_hash_table<int, int> h[N];
vi e[N];
int cnt[N], vis[N], p[N];
int solve(const vi &v){
    rep(j, 0, sz(v)){
        int x = v[j];
        rep(l, j + 1, sz(v)){
            int y = v[l];
            if(h[x].find(y) == h[x].end())
                return 0;
        }
    }
    return 1;
}
bool cmp(int a,int b){
    return cnt[a] < cnt[b];
}
int main() {
    int T;
    scanf("%d", &T);
    while(T--){
        int n, m, k;
        scanf("%d%d%d", &n, &m, &k);
        rep(i, 1, n + 1) {
            h[i].clear();
            e[i].clear();
            cnt[i] = 0;
            vis[i] = 1;
        }
        rep(i, 1, m + 1){
            int x, y;
            scanf("%d%d", &x, &y);
            e[x].pb(y); e[y].pb(x);
            cnt[x]++;  cnt[y]++;
            h[x][y] = 1;
            h[y][x] = 1;
        }
        vi v;
        rep(i, 1, n + 1) if(cnt[i] < k - 1)
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            vis[x] = 0;
            for(auto u:e[x]) if(vis[x]){
                cnt[u]--;
                if(cnt[u] == k - 2)
                    v.pb(u);
            }
        }
        int f = 0;
        queue<int > q;
        rep(i, 1, n + 1)if(vis[i] && cnt[i] == k - 1)
            q.push(i);
        while(sz(q)){
            int x = q.front();
            q.pop();
            vi v;
            v.pb(x);
            for(auto u:e[x])
                if(vis[u]) v.pb(u);
            if(sz(v) == k && solve(v)){
                printf("2\n");
                rep(i, 0, sz(v)){
                    printf("%d%c", v[i], " \n"[i==sz(v)-1]);
                }
                f = 1;
                break;
            }
            vis[x] = 0;
            for(auto u:e[x]){
                cnt[u]--;
                if(vis[u] && cnt[u] == k - 1){
                    q.push(u);
                }
            }
        }
        if(f) continue;
        v.clear();
        rep(i, 1, n + 1) if(cnt[i] < k && vis[i])
            v.pb(i);
        rep(i, 0, sz(v)){
            int x = v[i];
            vis[x] = 0;
            for(auto u:e[x]){
                cnt[u]--;
                if(vis[u] && cnt[u] == k - 1)
                    v.pb(u);
            }
        }
        vi ans;
        rep(i, 1, n + 1) if(vis[i] && cnt[i] >= k){
            ans.pb(i);
        }
        if(!sz(ans)) printf("-1\n");
        else {
            printf("1 %d\n", sz(ans));
            rep(i, 0, sz(ans)){
                printf("%d%c", ans[i], " \n"[i==sz(ans)-1]);
            }
        }
    }
    return 0;
}


/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define INF (~(1<<31))
#define eps 1e-8
#define PI 3.141592653589793238462643383
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define all(v) (v).begin(),(v).end()
#define dbg(x,y) cout<<(x)<<" = "<<(y)<< endl;
#define per(i,a,b) for(int i = a; i >= b; --i)
#define rep(i,a,b) for(int i = a; i <= b; ++i)
#define fi first
#define se second
#define ls (rt<<1)
#define rs (rt<<1|1)
#define ll long long
#define int ll

typedef bitset<2010> bt;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const ll N = 1e5 + 7;
const ll M = 1e9 + 7;
const ll MAXN = 2e18 + 7;
const ll Mod = 998244353;
//const ll Mod = 1e9 + 9;

int _,i,j,k,n,m,p,q,s,T,t,l,r,o,u,v,w,x,y,z,ans,nex,sum,num,len,cnt,en,sx,sy,tx,ty,th,ma,mi,mod,op,res,flag,cas,bk,ret,mid,now,tmp,rt;
int a[N],b[N],c[N],d[N],vis[N];
char ch;
vector<int> g[N],h,f;
string s1,s2,s3;

signed main()
{
    int T = 1;
    queue<int> q;
    scanf("%lld",&T);
    while(T--){
        scanf("%lld%lld%lld",&n,&m,&k);
        for(i = 1;i <= n;i++) g[i].clear(),vis[i]=0;
        for(i = 1;i <= m;i++){
            scanf("%lld%lld",&u,&v);
            g[u].pb(v);
            g[v].pb(u);
        }
        while(!q.empty()) q.pop();
        for(i = 1;i <= n;i++){
            a[i]=g[i].size();
            sort(all(g[i]));
            if(a[i]<k) q.push(i);
        }
        flag=0;
        while(!q.empty()){
            u=q.front();q.pop();
            vis[u]=1;
            if(a[u]==k-1&&k*(k-1)/2<=m){
                f.clear();
                f.pb(u);
                flag=1;
                for(auto v:g[u]) if(!vis[v]) f.pb(v);
                if(f.size()<k) flag=0;
                for(auto v:f){
                    for(auto w:f){
                        if(v==w) continue;
                        if(!binary_search(all(g[v]),w)){
                            flag=0;
                            break;
                        }
                    }
                    if(!flag) break;
                }
                if(flag){
                    printf("2\n");
                    for(auto v:f){
                        printf("%lld ",v);
                    }
                    printf("\n");
                    break;
                }
            }
            for(auto v:g[u]){
                if(a[v]==k) q.push(v);
                a[v]--;
            }
        }
        //dbg(-1,flag)
        if(flag) continue;
        h.clear();
        for(i = 1;i <= n;i++){
            if(a[i]) h.pb(i);
        }
        if(h.size()){
            printf("1 %lld\n",(int)h.size());
            for(i = 0;i < h.size();i++)
                printf("%lld ",h[i]);
            printf("\n");
            continue;
        }
        printf("-1\n");
    }
    return 0;
}


/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define INF (~(1<<31))
#define eps 1e-8
#define PI 3.141592653589793238462643383
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define all(v) (v).begin(),(v).end()
#define dbg(x,y) cout<<(x)<<" = "<<(y)<< endl;
#define per(i,a,b) for(int i = a; i >= b; --i)
#define rep(i,a,b) for(int i = a; i <= b; ++i)
#define fi first
#define se second
#define ls (rt<<1)
#define rs (rt<<1|1)
#define ll long long
#define int ll

typedef bitset<2010> bt;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const ll N = 1e5 + 7;
const ll M = 1e9 + 7;
const ll MAXN = 2e18 + 7;
const ll Mod = 998244353;
//const ll Mod = 1e9 + 9;

int _,i,j,k,n,m,p,q,s,T,t,l,r,o,u,v,w,x,y,z,ans,nex,sum,num,len,cnt,en,sx,sy,tx,ty,th,ma,mi,mod,op,res,flag,cas,bk,ret,mid,now,tmp,rt;
int a[N],b[N],c[N],d[N];
char ch;
vector<int> g[N],h,f;
string s1,s2,s3;

signed main()
{
    int T = 1;
    queue<int> q;
    scanf("%lld",&T);
    while(T--){
        scanf("%lld%lld%lld",&n,&m,&k);
        for(i = 1;i <= n;i++) g[i].clear();
        for(i = 1;i <= m;i++){
            scanf("%lld%lld",&u,&v);
            g[u].pb(v);
            g[v].pb(u);
        }
        while(!q.empty()) q.pop();
        for(i = 1;i <= n;i++){
            a[i]=g[i].size();
            sort(all(g[i]));
            if(a[i]<k) q.push(i);
        }
        flag=0;
        while(!q.empty()){
            u=q.front();q.pop();
            flag=0;
            if(a[u]==k-1&&k*(k-1)/2<=m){
                f.clear();
                f.pb(u);
                flag=1;
                for(auto v:g[u]) if(a[v]>=k) f.pb(v);
                if(f.size()<k) flag=0;
                for(auto v:f){
                    for(auto w:f){
                        if(v==w) continue;
                        if(!binary_search(all(g[v]),w)){
                            flag=0;
                            break;
                        }
                    }
                    if(!flag) break;
                }
                if(flag){
                    printf("2\n");
                    for(auto v:f){
                        printf("%lld ",v);
                    }
                    printf("\n");
                    break;
                }
            }
            for(auto v:g[u]){
                if(a[v]==k) q.push(v);
                a[v]--;
            }
        }
        //dbg(-1,flag)
        if(flag) continue;
        h.clear();
        for(i = 1;i <= n;i++){
            if(a[i]) h.pb(i);
        }
        if(h.size()){
            printf("1 %lld\n",(int)h.size());
            for(i = 0;i < h.size();i++)
                printf("%lld ",h[i]);
            printf("\n");
            continue;
        }
        printf("-1\n");
    }
    return 0;
}


/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define INF (~(1<<31))
#define eps 1e-8
#define PI 3.141592653589793238462643383
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define all(v) (v).begin(),(v).end()
#define dbg(x,y) cout<<(x)<<" = "<<(y)<< endl;
#define per(i,a,b) for(int i = a; i >= b; --i)
#define rep(i,a,b) for(int i = a; i <= b; ++i)
#define fi first
#define se second
#define ls (rt<<1)
#define rs (rt<<1|1)
#define ll long long
#define int ll

typedef bitset<2010> bt;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const ll N = 1e5 + 7;
const ll M = 1e9 + 7;
const ll MAXN = 2e18 + 7;
const ll Mod = 998244353;
//const ll Mod = 1e9 + 9;

int _,i,j,k,n,m,p,q,s,T,t,l,r,o,u,v,w,x,y,z,ans,nex,sum,num,len,cnt,en,sx,sy,tx,ty,th,ma,mi,mod,op,res,flag,cas,bk,ret,mid,now,tmp,rt;
int a[N],b[N],c[N],d[N];
char ch;
vector<int> g[N],h,f;
string s1,s2,s3;

signed main()
{
    int T = 1;
    queue<int> q;
    scanf("%lld",&T);
    while(T--){
        scanf("%lld%lld%lld",&n,&m,&k);
        for(i = 1;i <= n;i++) g[i].clear(),vis[i]=0;
        for(i = 1;i <= m;i++){
            scanf("%lld%lld",&u,&v);
            g[u].pb(v);
            g[v].pb(u);
        }
        while(!q.empty()) q.pop();
        for(i = 1;i <= n;i++){
            a[i]=g[i].size();
            sort(all(g[i]));
            if(a[i]<k) q.push(i);
        }
        flag=0;
        while(!q.empty()){
            u=q.front();q.pop();
            vis[u]=1;
            if(a[u]==k-1&&k*(k-1)/2<=m){
                f.clear();
                f.pb(u);
                flag=1;
                for(auto v:g[u]) if(!vis[v]) f.pb(v);
                if(f.size()<k) flag=0;
                for(auto v:f){
                    for(auto w:f){
                        if(v==w) continue;
                        if(!binary_search(all(g[v]),w)){
                            flag=0;
                            break;
                        }
                    }
                    if(!flag) break;
                }
                if(flag){
                    printf("2\n");
                    for(auto v:f){
                        printf("%lld ",v);
                    }
                    printf("\n");
                    break;
                }
            }
            for(auto v:g[u]){
                if(a[v]==k) q.push(v);
                a[v]--;
            }
        }
        //dbg(-1,flag)
        if(flag) continue;
        h.clear();
        for(i = 1;i <= n;i++){
            if(a[i]) h.pb(i);
        }
        if(h.size()){
            printf("1 %lld\n",(int)h.size());
            for(i = 0;i < h.size();i++)
                printf("%lld ",h[i]);
            printf("\n");
            continue;
        }
        printf("-1\n");
    }
    return 0;
}


/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define INF (~(1<<31))
#define eps 1e-8
#define PI 3.141592653589793238462643383
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define all(v) (v).begin(),(v).end()
#define dbg(x,y) cout<<(x)<<" = "<<(y)<< endl;
#define per(i,a,b) for(int i = a; i >= b; --i)
#define rep(i,a,b) for(int i = a; i <= b; ++i)
#define fi first
#define se second
#define ls (rt<<1)
#define rs (rt<<1|1)
#define ll long long
#define int ll

typedef bitset<2010> bt;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const ll N = 1e5 + 7;
const ll M = 1e9 + 7;
const ll MAXN = 2e18 + 7;
const ll Mod = 998244353;
//const ll Mod = 1e9 + 9;

int _,i,j,k,n,m,p,q,s,T,t,l,r,o,u,v,w,x,y,z,ans,nex,sum,num,len,cnt,en,sx,sy,tx,ty,th,ma,mi,mod,op,res,flag,cas,bk,ret,mid,now,tmp,rt;
int a[N],b[N],c[N],d[N],vis[N];
char ch;
vector<int> g[N],h,f;
string s1,s2,s3;

signed main()
{
    int T = 1;
    queue<int> q;
    scanf("%lld",&T);
    while(T--){
        scanf("%lld%lld%lld",&n,&m,&k);
        for(i = 1;i <= n;i++) g[i].clear(),vis[i]=0;
        for(i = 1;i <= m;i++){
            scanf("%lld%lld",&u,&v);
            g[u].pb(v);
            g[v].pb(u);
        }
        while(!q.empty()) q.pop();
        for(i = 1;i <= n;i++){
            a[i]=g[i].size();
            sort(all(g[i]));
            if(a[i]<k) q.push(i);
        }
        flag=0;
        while(!q.empty()){
            u=q.front();q.pop();
            vis[u]=1;
            if(a[u]==k-1&&k*(k-1)/2<=m){
                f.clear();
                f.pb(u);
                flag=1;
                for(auto v:g[u]) if(!vis[v]) f.pb(v);
                for(auto v:f){
                    for(auto w:f){
                        if(v==w) continue;
                        if(!binary_search(all(g[v]),w)){
                            flag=0;
                            break;
                        }
                    }
                    if(!flag) break;
                }
                if(flag){
                    printf("2\n");
                    for(auto v:f){
                        printf("%lld ",v);
                    }
                    printf("\n");
                    break;
                }
            }
            for(auto v:g[u]){
                if(a[v]==k) q.push(v);
                a[v]--;
            }
        }
        //dbg(-1,flag)
        if(flag) continue;
        h.clear();
        for(i = 1;i <= n;i++){
            if(a[i]>=k) h.pb(i);
        }
        if(h.size()){
            printf("1 %lld\n",(int)h.size());
            for(i = 0;i < h.size();i++)
                printf("%lld ",h[i]);
            printf("\n");
            continue;
        }
        printf("-1\n");
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
namespace CF1439B {
const int N=100010,M=100010,BarK=450;//BarK^2/2>M
int n,m,k,d[N]={},del[N]={};
set<int> snei[N];
vector<int> nei[N];
bool check(int now)
{
	int l[BarK]={};
	int t=0;
	l[++t]=now;
	for(auto p:nei[now])
		if(!del[p])
			l[++t]=p;
	if(t<k)
		return false;
	assert(t==k);
	for(int i=1;i<=t;++i)
		for(int j=1;j<i;++j)
			if(!snei[l[i]].count(l[j]))
				return false;
	return true;
}
int start()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d%d%d",&n,&m,&k);
		//n=100000;
		//m=100000;
		for(int i=1;i<=n;++i)
			nei[i].clear();
		for(int i=1,u,v;i<=m;++i)
		{
			//u=rand()+1;
			//v=rand()+1;
			scanf("%d%d",&u,&v);
			nei[u].push_back(v);
			nei[v].push_back(u);
		}
		if(k==1)
		{
			printf("2\n1\n");
			continue;
		}
		if(k>=BarK || k*(k-1)/2>m)
		{
			puts("-1");
			continue;
		}
		for(int i=1;i<=n;++i)
		{
			d[i]=nei[i].size();
			del[i]=false;
		}
		queue<int> q;
		for(int i=1;i<=n;++i)
			if(d[i]<k-1)
			{
				q.push(i);
				del[i]=true;
			}
		while(!q.empty())
		{
			int now=q.front();
			q.pop();
			for(auto p:nei[now])
				if(--d[p]<k-1 && !del[p])
				{
					q.push(p);
					del[p]=true;
				}
		}
		int tot=0;
		for(int i=1;i<=n;++i)
			snei[i].clear();
		for(int i=1;i<=n;++i)
		{
			if(del[i])
				continue;
			++tot;
			for(auto p:nei[i])
				if(!del[p])
					snei[i].insert(p);
			if(d[i]==k-1)
				q.push(i);
		}
		bool clique=false;
		while(!q.empty())
		{
			int now=q.front();
			q.pop();
			//cout<<"now="<<now<<endl;
			if(check(now))
			{
				clique=true;
				puts("2");
				printf("%d",now);
				for(auto p:nei[now])
					if(!del[p])
						printf(" %d",p);
				puts("");
				break;
			}
			else
			{
				--tot;
				del[now]=true;
				for(auto p:nei[now])
					if(--d[p]==k-1)
						q.push(p);
			}
		}
		if(tot)
		{
			if(clique)
				continue;
			printf("1 %d\n",tot);
			for(int i=1;i<=n;++i)
				if(!del[i])
					printf("%d ",i);
			printf("\n");
		}
		else
			puts("-1");
	}
	return 0;
}
}
int main()
{
	return CF1439B::start();
}


#include<bits/stdc++.h>
using namespace std;
namespace CF1439B {
const int N=100010,M=100010,BarK=450;//BarK^2/2>M
int n,m,k,d[N]={},del[N]={};
int num[N]={},renum[BarK]={};
bitset<BarK> a[BarK];
vector<int> nei[N];
bool check(int now)
{
	int l[BarK]={};
	int t=0;
	l[++t]=now;
	for(auto p:nei[now])
		if(!del[p])
			l[++t]=p;
	assert(now==k);
	bitset<BarK> tmp;
	for(int i=1;i<=t;++i)
		tmp[l[i]]=1;
	for(int i=1;i<=t;++i)
		tmp&=a[l[i]];
	for(int i=1;i<=t;++i)
		if(!tmp[l[i]])
			return false;
	return true;
}
int start()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d%d%d",&n,&m,&k);
		for(int i=1;i<=n;++i)
			nei[i].clear();
		for(int i=1,u,v;i<=m;++i)
		{
			scanf("%d%d",&u,&v);
			nei[u].push_back(v);
			nei[v].push_back(u);
		}
		if(k>=BarK || k*(k-1)/2>m)
		{
			puts("-1");
			continue;
		}
		for(int i=1;i<=n;++i)
		{
			d[i]=nei[i].size();
			del[i]=false;
		}
		queue<int> q;
		for(int i=1;i<=n;++i)
			if(d[i]<k-1)
			{
				q.push(i);
				del[i]=true;
			}
		while(!q.empty())
		{
			int now=q.front();
			q.pop();
			for(auto p:nei[now])
				if(--d[p]<k-1 && !del[p])
				{
					q.push(p);
					del[p]=true;
				}
		}
		int tot=0;
		for(int i=1;i<=n;++i)
			if(!del[i])
			{
				num[i]=++tot;
				renum[tot]=i;
			}
		for(int i=1;i<=tot;++i)
			for(int j=1;j<=tot;++j)
				a[i][j]=(i==j);
		for(int i=1;i<=tot;++i)
		{
			for(auto p:nei[renum[i]])
				if(!del[p])
					a[i][num[p]]=a[num[p]][i]=true;
			if(d[i]==k-1)
				q.push(i);
		}
		bool clique=false;
		while(!q.empty())
		{
			int now=q.front();
			q.pop();
			if(check(now))
			{
				clique=true;
				puts("2");
				printf("%d",now);
				for(auto p:nei[now])
					if(!del[p])
						printf(" %d",p);
				puts("");
				break;
			}
			else
			{
				--tot;
				del[now]=true;
				for(auto p:nei[now])
					if(--d[p]==k-1)
						q.push(p);
			}
		}
		if(tot)
		{
			if(clique)
				continue;
			printf("1 %d\n",tot);
			for(int i=1;i<=n;++i)
				if(!del[i])
					printf("%d ",i);
			printf("\n");
		}
		else
			puts("-1");
	}
	return 0;
}
}
int main()
{
	return CF1439B::start();
}


#include<bits/stdc++.h>
using namespace std;
namespace CF1439B {
const int N=100010,M=100010,BarK=450;//BarK^2/2>M
int n,m,k,d[N]={},del[N]={};
int num[N]={},renum[BarK]={};
bitset<BarK> a[BarK];
vector<int> nei[N];
bool check(int now)
{
	int l[BarK]={};
	int t=0;
	l[++t]=num[now];
	for(auto p:nei[now])
		if(!del[p])
			l[++t]=num[p];
	assert(now==k);
	bitset<BarK> tmp;
	for(int i=1;i<=t;++i)
		tmp[l[i]]=1;
	for(int i=1;i<=t;++i)
		tmp&=a[l[i]];
	for(int i=1;i<=t;++i)
		if(!tmp[l[i]])
			return false;
	return true;
}
int start()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d%d%d",&n,&m,&k);
		for(int i=1;i<=n;++i)
			nei[i].clear();
		for(int i=1,u,v;i<=m;++i)
		{
			scanf("%d%d",&u,&v);
			nei[u].push_back(v);
			nei[v].push_back(u);
		}
		if(k>=BarK || k*(k-1)/2>m)
		{
			puts("-1");
			continue;
		}
		for(int i=1;i<=n;++i)
		{
			d[i]=nei[i].size();
			del[i]=false;
		}
		queue<int> q;
		for(int i=1;i<=n;++i)
			if(d[i]<k-1)
			{
				q.push(i);
				del[i]=true;
			}
		while(!q.empty())
		{
			int now=q.front();
			q.pop();
			for(auto p:nei[now])
				if(--d[p]<k-1 && !del[p])
				{
					q.push(p);
					del[p]=true;
				}
		}
		int tot=0;
		for(int i=1;i<=n;++i)
			if(!del[i])
			{
				num[i]=++tot;
				renum[tot]=i;
			}
		for(int i=1;i<=tot;++i)
			for(int j=1;j<=tot;++j)
				a[i][j]=(i==j);
		for(int i=1;i<=tot;++i)
		{
			for(auto p:nei[renum[i]])
				if(!del[p])
					a[i][num[p]]=a[num[p]][i]=true;
			if(d[renum[i]]==k-1)
				q.push(renum[i]);
		}
		bool clique=false;
		while(!q.empty())
		{
			int now=q.front();
			q.pop();
			if(check(now))
			{
				clique=true;
				puts("2");
				printf("%d",now);
				for(auto p:nei[now])
					if(!del[p])
						printf(" %d",p);
				puts("");
				break;
			}
			else
			{
				--tot;
				del[now]=true;
				for(auto p:nei[now])
					if(--d[p]==k-1)
						q.push(p);
			}
		}
		if(tot)
		{
			if(clique)
				continue;
			printf("1 %d\n",tot);
			for(int i=1;i<=n;++i)
				if(!del[i])
					printf("%d ",i);
			printf("\n");
		}
		else
			puts("-1");
	}
	return 0;
}
}
int main()
{
	return CF1439B::start();
}


#include<bits/stdc++.h>
using namespace std;
namespace CF1439B {
const int N=100010,M=100010,BarK=450;//BarK^2/2>M
int n,m,k,d[N]={},del[N]={};
int num[N]={},renum[BarK]={},a[BarK][BarK]={};
vector<int> nei[N];
bool check(int now)
{
	int l[BarK]={};
	int t=0;
	l[++t]=now;
	for(auto p:nei[now])
		if(!del[p])
			l[++t]=p;
	assert(now==k);
	for(int i=1;i<=t;++i)
		for(int j=1;j<i;++j)
			if(!a[l[i]][l[j]])
				return false;
	return true;
}
int start()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d%d%d",&n,&m,&k);
		for(int i=1;i<=n;++i)
			nei[i].clear();
		for(int i=1,u,v;i<=m;++i)
		{
			scanf("%d%d",&u,&v);
			nei[u].push_back(v);
			nei[v].push_back(u);
		}
		if(k>=BarK || k*(k-1)/2>m)
		{
			puts("-1");
			continue;
		}
		for(int i=1;i<=n;++i)
		{
			d[i]=nei[i].size();
			del[i]=false;
		}
		queue<int> q;
		for(int i=1;i<=n;++i)
			if(d[i]<k-1)
			{
				q.push(i);
				del[i]=true;
			}
		while(!q.empty())
		{
			int now=q.front();
			for(auto p:nei[now])
				if(--d[p]<k-1 && !del[p])
				{
					q.push(p);
					del[p]=true;
				}
		}
		int tot=0;
		for(int i=1;i<=n;++i)
			if(!del[i])
			{
				num[i]=++tot;
				renum[tot]=i;
			}
		for(int i=1;i<=tot;++i)
			for(int j=1;j<=tot;++j)
				a[i][j]=(i==j);
		for(int i=1;i<=tot;++i)
		{
			for(auto p:nei[renum[i]])
				if(!del[p])
					a[i][num[p]]=a[num[p]][i]=true;
			if(d[i]==k-1)
				q.push(i);
		}
		bool clique=false;
		while(!q.empty())
		{
			int now=q.front();
			q.pop();
			if(check(now))
			{
				clique=true;
				puts("2");
				printf("%d",now);
				for(auto p:nei[now])
					if(!del[p])
						printf(" %d",p);
				puts("");
				break;
			}
			else
			{
				--tot;
				del[now]=true;
				for(auto p:nei[now])
					if(--d[p]==k-1)
						q.push(p);
			}
		}
		if(tot)
		{
			if(clique)
				continue;
			printf("1 %d\n",tot);
			for(int i=1;i<=n;++i)
				if(!del[i])
					printf("%d ",i);
			printf("\n");
		}
		else
			puts("-1");
	}
	return 0;
}
}
int main()
{
	return CF1439B::start();
}


    //orz Gold_7
//orz SqwrIwy
//orz yzh1505
//orz yzh2019
//orz new
//orz hejinfan
//orz chenkuowen
//#pragma comment(linker,?STACK:1677721600?
//#pragma GCC optimize("O2")
//#pragma G++ optimize("O2")
//#pragma GCC optimize("O3")
//#pragma G++ optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128 ll;
typedef unsigned int uint;
typedef unsigned long long ull;
//typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1

#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Flush FastIO::Fflush()

const int N=555555;
const int M=555555;
const int MOD=1e9+7;
//const int MOD2=998244353;
//const int inv2=(MOD+1)/2;
const int intINF=int(1e9);
const ll llINF=ll(2e18);
const uint uintINF=~0U;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
const long double pi=acos(-1.0L);
const int eps=222222;

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}*/

/*ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int d[222222],dfn[222222],ans[222222],can[222222],num[222222],n,m,k;
VI G[222222];
VI p;
VII c[222222];

void predo()
{
}

void init()
{
    n=read(),m=read(),k=read();
    rep(i,1,n) G[i].clear();
    rep(i,1,m)
    {
        int x=read(),y=read();
        G[x].pb(y);
        G[y].pb(x);
    }
}

void print1()
{
    int sz=0;
    rep(i,1,n)
    {
        if(dfn[i]==0) sz++;
    }
    printf("1 %d\n",sz);
    rep(i,1,n)
    {
        if(dfn[i]==0) printf("%d ",i);
    }
    printf("\n");
}

priority_queue<PII> q;

bool cmp(int a,int b)
{
    return dfn[a]<dfn[b];
}

void solve()
{
    if(1ll*k*k>2*m)
    {
        printf("-1\n");
        return;
    }

    while(!q.empty()) q.pop();
    rep(i,1,n)
    {
        q.push(MP(-d[i],i));
    }

    rep(i,1,n) dfn[i]=0;
    p.clear();
    int tim=0;
    while(!q.empty())
    {
        int u=q.top().se;
        q.pop();
        tim++;
        //printf("u=%d d[u]=%d\n",u,d[u]);

        if(d[u]>=k)
        {
            print1();
            return;
        }

        dfn[u]=tim;
        for(auto v:G[u])
        {
            if(dfn[v]==0)
            {
                d[u]--;
                if(d[u]>=0) q.push(MP(-d[u],u));
            }
        }
        p.pb(u);
    }

    rep(i,1,n) ans[i]=0;
    rep(i,1,n) c[i].clear();
    for(auto i:p)
    {
        int n=0;
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i])
            {
                num[++n]=j;
                can[j]=1;
            }
        }
        for(auto t:c[i])
        {
            if(!can[t.fi]) ans[t.se]=0;
        }
        rep(j,1,n) can[num[j]]=0;
        if(n!=k-1) continue;
        ans[i]=1;
        sort(num+1,num+n+1,cmp);
        rep(j,1,n)
         rep(k,j+1,n) c[num[j]].pb(MP(num[k],i));
    }

    for(auto i:p)
    {
        if(!ans[i]) continue;
        printf("2\n");
        printf("%d ",i);
        for(auto j:p)
        {
            if(dfn[j]>dfn[i]) printf("%d ",j);
        }
        printf("\n");
    }
    printf("-1\n");
}

int main()
{
   //freopen("1.in","r",stdin);
   //freopen("1.out","w",stdout);
   predo();
   int cas=read();
   //int cas=1;
   rep(v,1,cas)
   {
       //printf("Case #%d: ",v);
       init();
       solve();
   }
   return 0;
}


    //orz Gold_7
//orz SqwrIwy
//orz yzh1505
//orz yzh2019
//orz new
//orz hejinfan
//orz chenkuowen
//#pragma comment(linker,?STACK:1677721600?
//#pragma GCC optimize("O2")
//#pragma G++ optimize("O2")
//#pragma GCC optimize("O3")
//#pragma G++ optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128 ll;
typedef unsigned int uint;
typedef unsigned long long ull;
//typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1

#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Flush FastIO::Fflush()

const int N=555555;
const int M=555555;
const int MOD=1e9+7;
//const int MOD2=998244353;
//const int inv2=(MOD+1)/2;
const int intINF=int(1e9);
const ll llINF=ll(2e18);
const uint uintINF=~0U;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
const long double pi=acos(-1.0L);
const int eps=222222;

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}*/

/*ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int d[222222],dfn[222222],ans[222222],can[222222],num[222222],n,m,k;
VI G[222222];
VI p;
VII c[222222];
set<PII>S;

void predo()
{
}

void init()
{
    n=read(),m=read(),k=read();
    rep(i,1,n) G[i].clear();
    rep(i,1,n) d[i]=0;
    rep(i,1,m)
    {
        int x=read(),y=read();
        G[x].pb(y);
        G[y].pb(x);
        d[x]++;
        d[y]++;
    }
}

void print1()
{
    printf("1 %d\n",(int)S.size());
    for(auto t:S) printf("%d ",t.se);
    printf("\n");
}

bool cmp(int a,int b)
{
    return dfn[a]<dfn[b];
}

void solve()
{
    if(1ll*k*k>2*m)
    {
        printf("-1\n");
        return;
    }

    S.clear();
    rep(i,1,n)
    {
        S.insert(MP(d[i],i));
    }

    rep(i,1,n) dfn[i]=0;
    p.clear();
    int tim=0;
    while((int)S.size())
    {
        PII tmp=*S.begin();
        int du=tmp.fi,u=tmp.se;
        //printf("du=%d u=%d\n",du,u);
        tim++;

        if(du>=k)
        {
            print1();
            return;
        }
        S.erase(*S.begin());

        dfn[u]=tim;
        for(auto v:G[u])
        {
            if(dfn[v]==0)
            {
                S.erase(MP(d[v],v));
                d[v]--;
                S.insert(MP(d[v],v));
            }
        }
        p.pb(u);
    }

    rep(i,1,n) ans[i]=0;
    rep(i,1,n) c[i].clear();
    for(auto i:p)
    {
        int sz=0;
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i])
            {
                num[++sz]=j;
                can[j]=1;
            }
        }
        for(auto t:c[i])
        {
            if(!can[t.fi]) ans[t.se]=0;
        }
        rep(j,1,sz) can[num[j]]=0;
        if(sz!=k-1) continue;
        ans[i]=1;
        sort(num+1,num+sz+1,cmp);
        rep(j,1,sz)
         rep(k,j+1,sz) c[num[j]].pb(MP(num[k],i));
    }

    for(auto i:p)
    {
        if(!ans[i]) continue;
        printf("2\n");
        printf("%d ",i);
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i]) printf("%d ",j);
        }
        printf("\n");
        return;
    }
    printf("-1\n");
}

int main()
{
   //freopen("1.in","r",stdin);
   //freopen("1.out","w",stdout);
   predo();
   int cas=read();
   //int cas=1;
   rep(v,1,cas)
   {
       //printf("Case #%d: ",v);
       init();
       solve();
   }
   return 0;
}


    //orz Gold_7
//orz SqwrIwy
//orz yzh1505
//orz yzh2019
//orz new
//orz hejinfan
//orz chenkuowen
//#pragma comment(linker,?STACK:1677721600?
//#pragma GCC optimize("O2")
//#pragma G++ optimize("O2")
//#pragma GCC optimize("O3")
//#pragma G++ optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128 ll;
typedef unsigned int uint;
typedef unsigned long long ull;
//typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1

#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Flush FastIO::Fflush()

const int N=555555;
const int M=555555;
const int MOD=1e9+7;
//const int MOD2=998244353;
//const int inv2=(MOD+1)/2;
const int intINF=int(1e9);
const ll llINF=ll(2e18);
const uint uintINF=~0U;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
const long double pi=acos(-1.0L);
const int eps=222222;

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}*/

/*ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int d[222222],dfn[222222],ans[222222],can[222222],num[222222],n,m,k;
VI G[222222];
VI p;
VII c[222222];
set<PII>S;

void predo()
{
}

void init()
{
    n=read(),m=read(),k=read();
    rep(i,1,n) G[i].clear();
    rep(i,1,n) d[i]=0;
    rep(i,1,m)
    {
        int x=read(),y=read();
        G[x].pb(y);
        G[y].pb(x);
        d[x]++;
        d[y]++;
    }
}

void print1()
{
    printf("1 %d\n",(int)S.size());
    for(auto t:S) printf("%d ",t.se);
    printf("\n");
}

bool cmp(int a,int b)
{
    return dfn[a]<dfn[b];
}

void solve()
{
    /*if(1ll*k*k>2*m)
    {
        printf("-1\n");
        return;
    }*/
    if(k>500)
    {
        printf("-1\n");
        return;
    }

    S.clear();
    rep(i,1,n)
    {
        S.insert(MP(d[i],i));
    }

    rep(i,1,n) dfn[i]=0;
    p.clear();
    int tim=0;
    while((int)S.size())
    {
        PII tmp=*S.begin();
        int du=tmp.fi,u=tmp.se;
        //printf("du=%d u=%d\n",du,u);
        tim++;

        if(du>=k)
        {
            print1();
            return;
        }
        S.erase(*S.begin());

        dfn[u]=tim;
        for(auto v:G[u])
        {
            if(dfn[v]==0)
            {
                S.erase(MP(d[v],v));
                d[v]--;
                S.insert(MP(d[v],v));
            }
        }
        p.pb(u);
    }

    rep(i,1,n) ans[i]=0;
    rep(i,1,n) c[i].clear();
    for(auto i:p)
    {
        int sz=0;
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i])
            {
                num[++sz]=j;
                can[j]=1;
            }
        }
        for(auto t:c[i])
        {
            if(!can[t.fi]) ans[t.se]=0;
        }
        rep(j,1,sz) can[num[j]]=0;
        if(sz!=k-1) continue;
        ans[i]=1;
        sort(num+1,num+sz+1,cmp);
        rep(j,1,sz)
         rep(k,j+1,sz) c[num[j]].pb(MP(num[k],i));
    }

    for(auto i:p)
    {
        if(!ans[i]) continue;
        printf("2\n");
        printf("%d ",i);
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i]) printf("%d ",j);
        }
        printf("\n");
        return;
    }
    printf("-1\n");
}

int main()
{
   //freopen("1.in","r",stdin);
   //freopen("1.out","w",stdout);
   predo();
   int cas=read();
   //int cas=1;
   rep(v,1,cas)
   {
       //printf("Case #%d: ",v);
       init();
       solve();
   }
   return 0;
}


    //orz Gold_7
//orz SqwrIwy
//orz yzh1505
//orz yzh2019
//orz new
//orz hejinfan
//orz chenkuowen
//#pragma comment(linker,?STACK:1677721600?
//#pragma GCC optimize("O2")
//#pragma G++ optimize("O2")
//#pragma GCC optimize("O3")
//#pragma G++ optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128 ll;
typedef unsigned int uint;
typedef unsigned long long ull;
//typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1

#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Flush FastIO::Fflush()

const int N=555555;
const int M=555555;
const int MOD=1e9+7;
//const int MOD2=998244353;
//const int inv2=(MOD+1)/2;
const int intINF=int(1e9);
const ll llINF=ll(2e18);
const uint uintINF=~0U;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
const long double pi=acos(-1.0L);
const int eps=222222;

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}*/

/*ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int d[222222],dfn[222222],ans[222222],can[222222],num[222222],n,m,k;
VI G[222222];
VI p;
VII c[222222];
set<PII>S;

void predo()
{
}

void init()
{
    n=read(),m=read(),k=read();
    rep(i,1,n) G[i].clear();
    rep(i,1,m)
    {
        int x=read(),y=read();
        G[x].pb(y);
        G[y].pb(x);
        d[x]++;
        d[y]++;
    }
}

void print1()
{
    printf("1 %d\n",(int)S.size());
    for(auto t:S) printf("%d ",t.se);
    printf("\n");
}

bool cmp(int a,int b)
{
    return dfn[a]<dfn[b];
}

void solve()
{
    if(1ll*k*k>2*m)
    {
        printf("-1\n");
        return;
    }

    S.clear();
    rep(i,1,n)
    {
        S.insert(MP(d[i],i));
    }

    rep(i,1,n) dfn[i]=0;
    p.clear();
    int tim=0;
    while(!S.empty())
    {
        PII tmp=*S.begin();
        int du=tmp.fi,u=tmp.se;
        //printf("du=%d u=%d\n",du,u);
        tim++;

        if(du>=k)
        {
            print1();
            return;
        }
        S.erase(*S.begin());

        dfn[u]=tim;
        for(auto v:G[u])
        {
            if(dfn[v]==0)
            {
                S.erase(MP(d[v],v));
                d[v]--;
                S.insert(MP(d[v],v));
            }
        }
        p.pb(u);
    }

    rep(i,1,n) ans[i]=0;
    rep(i,1,n) c[i].clear();
    for(auto i:p)
    {
        int sz=0;
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i])
            {
                num[++sz]=j;
                can[j]=1;
            }
        }
        for(auto t:c[i])
        {
            if(!can[t.fi]) ans[t.se]=0;
        }
        rep(j,1,sz) can[num[j]]=0;
        if(sz!=k-1) continue;
        ans[i]=1;
        sort(num+1,num+sz+1,cmp);
        rep(j,1,sz)
         rep(k,j+1,sz) c[num[j]].pb(MP(num[k],i));
    }

    for(auto i:p)
    {
        if(!ans[i]) continue;
        printf("2\n");
        printf("%d ",i);
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i]) printf("%d ",j);
        }
        printf("\n");
        return;
    }
    printf("-1\n");
}

int main()
{
   //freopen("1.in","r",stdin);
   //freopen("1.out","w",stdout);
   predo();
   int cas=read();
   //int cas=1;
   rep(v,1,cas)
   {
       //printf("Case #%d: ",v);
       init();
       solve();
   }
   return 0;
}


    //orz Gold_7
//orz SqwrIwy
//orz yzh1505
//orz yzh2019
//orz new
//orz hejinfan
//orz chenkuowen
//#pragma comment(linker,?STACK:1677721600?
//#pragma GCC optimize("O2")
//#pragma G++ optimize("O2")
//#pragma GCC optimize("O3")
//#pragma G++ optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128 ll;
typedef unsigned int uint;
typedef unsigned long long ull;
//typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1

#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Flush FastIO::Fflush()

const int N=555555;
const int M=555555;
const int MOD=1e9+7;
//const int MOD2=998244353;
//const int inv2=(MOD+1)/2;
const int intINF=int(1e9);
const ll llINF=ll(2e18);
const uint uintINF=~0U;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
const long double pi=acos(-1.0L);
const int eps=222222;

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}*/

/*ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int d[222222],dfn[222222],ans[222222],can[222222],num[222222],n,m,k;
VI G[222222];
VI p;
VII c[222222];
set<PII>S;

void predo()
{
}

void init()
{
    n=read(),m=read(),k=read();
    rep(i,1,n) G[i].clear();
    rep(i,1,m)
    {
        int x=read(),y=read();
        G[x].pb(y);
        G[y].pb(x);
        d[x]++;
        d[y]++;
    }
}

void print1()
{
    printf("1 %d\n",(int)S.size());
    for(auto t:S) printf("%d ",t.se);
    printf("\n");
}

bool cmp(int a,int b)
{
    return dfn[a]<dfn[b];
}

void solve()
{
    if(1ll*k*k>2*m)
    {
        printf("-1\n");
        return;
    }

    S.clear();
    rep(i,1,n)
    {
        S.insert(MP(d[i],i));
    }

    rep(i,1,n) dfn[i]=0;
    p.clear();
    int tim=0;
    while((int)S.size())
    {
        PII tmp=*S.begin();
        int du=tmp.fi,u=tmp.se;
        //printf("du=%d u=%d\n",du,u);
        tim++;

        if(du>=k)
        {
            print1();
            return;
        }
        S.erase(*S.begin());

        dfn[u]=tim;
        for(auto v:G[u])
        {
            if(dfn[v]==0)
            {
                S.erase(MP(d[v],v));
                d[v]--;
                S.insert(MP(d[v],v));
            }
        }
        p.pb(u);
    }

    rep(i,1,n) ans[i]=0;
    rep(i,1,n) c[i].clear();
    for(auto i:p)
    {
        int sz=0;
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i])
            {
                num[++sz]=j;
                can[j]=1;
            }
        }
        for(auto t:c[i])
        {
            if(!can[t.fi]) ans[t.se]=0;
        }
        rep(j,1,sz) can[num[j]]=0;
        if(sz!=k-1) continue;
        ans[i]=1;
        sort(num+1,num+sz+1,cmp);
        rep(j,1,sz)
         rep(k,j+1,sz) c[num[j]].pb(MP(num[k],i));
    }

    for(auto i:p)
    {
        if(!ans[i]) continue;
        printf("2\n");
        printf("%d ",i);
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i]) printf("%d ",j);
        }
        printf("\n");
        return;
    }
    printf("-1\n");
}

int main()
{
   //freopen("1.in","r",stdin);
   //freopen("1.out","w",stdout);
   predo();
   int cas=read();
   //int cas=1;
   rep(v,1,cas)
   {
       //printf("Case #%d: ",v);
       init();
       solve();
   }
   return 0;
}


    //orz Gold_7
//orz SqwrIwy
//orz yzh1505
//orz yzh2019
//orz new
//orz hejinfan
//orz chenkuowen
//#pragma comment(linker,?STACK:1677721600?
//#pragma GCC optimize("O2")
//#pragma G++ optimize("O2")
//#pragma GCC optimize("O3")
//#pragma G++ optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128 ll;
typedef unsigned int uint;
typedef unsigned long long ull;
//typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1

#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Flush FastIO::Fflush()

const int N=555555;
const int M=555555;
const int MOD=1e9+7;
//const int MOD2=998244353;
//const int inv2=(MOD+1)/2;
const int intINF=int(1e9);
const ll llINF=ll(2e18);
const uint uintINF=~0U;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
const long double pi=acos(-1.0L);
const int eps=222222;

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}*/

/*ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int d[222222],dfn[222222],ans[222222],can[222222],num[222222],n,m,k;
VI G[222222];
VI p;
VII c[222222];
set<PII>S;

void predo()
{
}

void init()
{
    n=read(),m=read(),k=read();
    rep(i,1,n) G[i].clear();
    rep(i,1,m)
    {
        int x=read(),y=read();
        G[x].pb(y);
        G[y].pb(x);
        d[x]++;
        d[y]++;
    }
}

void print1()
{
    printf("1 %d\n",(int)S.size());
    for(auto t:S) printf("%d ",t.se);
    printf("\n");
}

bool cmp(int a,int b)
{
    return dfn[a]<dfn[b];
}

void solve()
{
    /*if(1ll*k*k>2*m)
    {
        printf("-1\n");
        return;
    }*/
    if(k>500)
    {
        printf("-1\n");
        return;
    }

    S.clear();
    rep(i,1,n)
    {
        S.insert(MP(d[i],i));
    }

    rep(i,1,n) dfn[i]=0;
    p.clear();
    int tim=0;
    while((int)S.size())
    {
        PII tmp=*S.begin();
        int du=tmp.fi,u=tmp.se;
        //printf("du=%d u=%d\n",du,u);
        tim++;

        if(du>=k)
        {
            print1();
            return;
        }
        S.erase(*S.begin());

        dfn[u]=tim;
        for(auto v:G[u])
        {
            if(dfn[v]==0)
            {
                S.erase(MP(d[v],v));
                d[v]--;
                S.insert(MP(d[v],v));
            }
        }
        p.pb(u);
    }

    rep(i,1,n) ans[i]=0;
    rep(i,1,n) c[i].clear();
    for(auto i:p)
    {
        int sz=0;
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i])
            {
                num[++sz]=j;
                can[j]=1;
            }
        }
        for(auto t:c[i])
        {
            if(!can[t.fi]) ans[t.se]=0;
        }
        rep(j,1,sz) can[num[j]]=0;
        if(sz!=k-1) continue;
        ans[i]=1;
        sort(num+1,num+sz+1,cmp);
        rep(j,1,sz)
         rep(k,j+1,sz) c[num[j]].pb(MP(num[k],i));
    }

    for(auto i:p)
    {
        if(!ans[i]) continue;
        printf("2\n");
        printf("%d ",i);
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i]) printf("%d ",j);
        }
        printf("\n");
        return;
    }
    printf("-1\n");
}

int main()
{
   //freopen("1.in","r",stdin);
   //freopen("1.out","w",stdout);
   predo();
   int cas=read();
   //int cas=1;
   rep(v,1,cas)
   {
       //printf("Case #%d: ",v);
       init();
       solve();
   }
   return 0;
}


    //orz Gold_7
//orz SqwrIwy
//orz yzh1505
//orz yzh2019
//orz new
//orz hejinfan
//orz chenkuowen
//#pragma comment(linker,?STACK:1677721600?
//#pragma GCC optimize("O2")
//#pragma G++ optimize("O2")
//#pragma GCC optimize("O3")
//#pragma G++ optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef __int128 ll;
typedef unsigned int uint;
typedef unsigned long long ull;
//typedef double db;
typedef long double ld;
typedef pair<int,int> PII;
typedef pair<ll,int> Pli;
typedef pair<ll,ll> Pll;
typedef vector<int> VI;
typedef vector<PII> VII;
//typedef pair<ll,ll>P;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define per(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define REP(i,n) for(int i=0;i<n;++i)
#define lowbit(x) x&(-x)
#define Rand (rand()*(1<<16)+rand())
#define id(x) ((x)<=B?(x):m-n/(x)+1)
#define fors(i) for(auto i:e[x]) if(i!=p)
#define ls p<<1
#define rs p<<1|1

#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define Flush FastIO::Fflush()

const int N=555555;
const int M=555555;
const int MOD=1e9+7;
//const int MOD2=998244353;
//const int inv2=(MOD+1)/2;
const int intINF=int(1e9);
const ll llINF=ll(2e18);
const uint uintINF=~0U;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
const long double pi=acos(-1.0L);
const int eps=222222;

int read()
{
   int v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

ll readll()
{
   ll v=0,f=1;
   char c=getchar();
   while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
   while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
   return v*f;
}

/*void pr128(__int128 x)
{
    if(x<0) putchar('-'),x=-x;
    if(x<10) return putchar('0'+x),void();
    pr128(x/10),putchar('0'+(x%10));
}*/

/*ll pw(ll x,ll y)
{
    ll res=1;
    while(y)
    {
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}*/

int d[222222],dfn[222222],ans[222222],can[222222],num[222222],n,m,k;
VI G[222222];
VI p;
VII c[222222];

void predo()
{
}

void init()
{
    n=read(),m=read(),k=read();
    rep(i,1,n) G[i].clear();
    rep(i,1,m)
    {
        int x=read(),y=read();
        G[x].pb(y);
        G[y].pb(x);
    }
}

void print1()
{
    int sz=0;
    rep(i,1,n)
    {
        if(dfn[i]==0) sz++;
    }
    printf("1 %d\n",sz);
    rep(i,1,n)
    {
        if(dfn[i]==0) printf("%d ",i);
    }
    printf("\n");
}

priority_queue<PII> q;

bool cmp(int a,int b)
{
    return dfn[a]<dfn[b];
}

void solve()
{
    if(1ll*k*k>2*m)
    {
        printf("-1\n");
        return;
    }

    while(!q.empty()) q.pop();
    rep(i,1,n)
    {
        q.push(MP(-d[i],i));
    }

    p.clear();
    int tim=0;
    while(!q.empty())
    {
        int u=q.top().se;
        q.pop();
        tim++;
        printf("u=%d d[u]=%d\n",u,d[u]);

        if(d[u]>=k)
        {
            print1();
            return;
        }

        dfn[u]=tim;
        for(auto v:G[u])
        {
            if(dfn[v]==0)
            {
                d[u]--;
                if(d[u]>=0) q.push(MP(-d[u],u));
            }
        }
        p.pb(u);
    }

    rep(i,1,n) ans[i]=0;
    rep(i,1,n) c[i].clear();
    for(auto i:p)
    {
        int n=0;
        for(auto j:G[i])
        {
            if(dfn[j]>dfn[i])
            {
                num[++n]=j;
                can[j]=1;
            }
        }
        for(auto t:c[i])
        {
            if(!can[t.fi]) ans[t.se]=0;
        }
        rep(j,1,n) can[num[j]]=0;
        if(n!=k-1) continue;
        ans[i]=1;
        sort(num+1,num+n+1,cmp);
        rep(j,1,n)
         rep(k,j+1,n) c[num[j]].pb(MP(num[k],i));
    }

    for(auto i:p)
    {
        if(!ans[i]) continue;
        printf("2\n");
        printf("%d ",i);
        for(auto j:p)
        {
            if(dfn[j]>dfn[i]) printf("%d ",j);
        }
        printf("\n");
    }
    printf("-1\n");
}

int main()
{
   //freopen("1.in","r",stdin);
   //freopen("1.out","w",stdout);
   predo();
   int cas=read();
   //int cas=1;
   rep(v,1,cas)
   {
       //printf("Case #%d: ",v);
       init();
       solve();
   }
   return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<bitset>
using namespace std;

#define P 1000007
#define N 401010
#define M 801010
#define mp make_pair
#define pb push_back
//#define M 202020
#define Inf 0x3f3f3f3f
//#define Inf 0x3f3f3f3f3f3f3f3f
//#define L (x<<1)
//#define R (x<<1|1)
//#define mid (l+r>>1)
typedef long long LL;

inline LL read() {
	LL x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return x*f;
}
inline bool num_read() {
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	return ch-'0';
}
void Write(LL x) {
	if(x<0)putchar('-'),x=-x;
	if(x>9)Write(x/10);
	putchar(x%10+48);
}
inline void writes(LL x) {Write(x),putchar(' ');}
inline void Writes(LL x) {Write(x),putchar('\n');}

int n,m,k;
int head[N],nxt[M],ver[M],Rdeg[N],deg[N],tot=1;
bool del[N],in[N];
vector <int> nei;
queue <int> q,dq;
vector <pair<int,int> > H[P];

inline void add(int x,int y) {ver[++tot]=y,nxt[tot]=head[x],head[x]=tot,Rdeg[y]++;}
inline int Hash(int x,int y) {LL now=0;now=1ll*x*P%P+1ll*y%P;return now%P;}
void Print() {
	cout<<"start--\n";
	for(int x=1;x<=n;++x) {
		//if(x != 23 and x != 54 and x != 41)continue ;
		if(del[x])	{printf("%d is dead\n",x);continue;}
		printf("deg[%d] is %d\n",x,deg[x]);
		for(int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			if(del[y])	continue;
			//cout<<x<<' '<<y<<endl;
		}
	}
	cout<<"end--\n";
}
void Print_nei() {
	cout<<"nei is :\n";
	for(int i=0;i<nei.size();++i)
		writes(nei[i]);
	puts("");
}
inline void Reset() {
	for(register int x=1;x<=n;++x)
		for(int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			H[Hash(x,y)].pop_back();
		}
	for(register int x=0;x<P;++x)
		if(!H[x].empty())
			cout<<0/0;
	for(register int i=1;i<=n;++i)
		in[i]=0,head[i]=0,Rdeg[i]=0;
	for(register int i=1;i<=tot;++i)
		nxt[i]=ver[i]=0;
	tot=1;
	nei.clear();
}
inline void topo() {
	while(!q.empty())
		q.pop();
	for(register int i=1;i<=n;++i)
		del[i]=0;
	for(register int i=1;i<=n;++i)
		del[i]=0,deg[i]=Rdeg[i];
	for(register int i=1;i<=n;++i)
		if(deg[i] < k)
			q.push(i),del[i]=1;
	while(!q.empty()) {
		int x=q.front();q.pop();
		for(register int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			deg[y]--;
			if(del[y])	continue;
			if(deg[y] < k)
				q.push(y),del[y]=1;
		}
	}
}
inline void Delete() {
	//printf("delete is : ");
	while(!dq.empty()) {
		int x=dq.front();dq.pop();
		//cout<<x<<' ';
		for(register int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			deg[y]--;
			if(!del[y] and deg[y] < k-1)
				dq.push(y),del[y]=1,deg[y]=-Inf;
			else if(!del[y] and !in[y] and deg[y] == k-1)
				q.push(y),in[y]=1;
		}
	}
	//puts("");
}
inline bool check() {
	//Print_nei();
	for(register int i=0;i<nei.size();++i) {
		int x=nei[i];
		for(register int j=i+1;j<nei.size();++j) {
			int y=nei[j];
			int tmp=Hash(x,y);bool f=0;
			for(register int k=0;k<H[tmp].size();++k)
				if(H[tmp][k].first == x and H[tmp][k].second == y) {
					f=1;
					break;
				}
			if(!f)	return 0;
		}
	}
	return true;
}
inline void work() {
	while(!q.empty())
		q.pop();
	while(!dq.empty())
		dq.pop();
	for(register int i=1;i<=n;++i)
		del[i]=0,deg[i]=Rdeg[i];
	for(register int i=1;i<=n;++i)
		if(deg[i] < k-1)
			dq.push(i),deg[i]=-Inf,del[i]=1;
		else if(deg[i] == k-1)
			q.push(i),in[i]=1;
	//puts("start");
	while(1) {
		Delete();
		//Print();
		if(q.empty())	return ;
		int x=q.front();q.pop();
		//cout<<x<<' ';
		if(del[x])	continue;
		nei.pb(x);
		for(int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			if(!del[y])
				nei.pb(y);
		}
		if(check()) {//puts("");
			return ;}
		nei.clear(),dq.push(x),deg[x]=-Inf,del[x]=1;
	}
	//puts("");
}

int main() {
	int T=read();
	for(int t=1;t<=T;++t) {
		Reset();
		n=read(),m=read(),k=read();
		//if(T == 9 and t == 6)
		//	printf("now ! data ! \n%d %d %d\n",n,m,k);
		for(int i=1,x,y;i<=m;++i) {
			x=read(),y=read();
			//if(T == 9 and t == 6) {
			//	printf("%d %d\n",x,y);
			//}
			add(x,y),add(y,x);
			H[Hash(x,y)].pb(mp(x,y)),H[Hash(y,x)].pb(mp(y,x));
		}
		//if(T == 4 and t != 4)	continue;
		if(k*(k-1) > 2*m) {
			puts("-1");
			continue;
		}
		//start type 1
		topo();
		int num=0;
		for(int i=1;i<=n;++i)
			if(!del[i])	num++;
		if(num) {
			writes(1),Writes(num);
			for(int i=1;i<=n;++i)
				if(!del[i])	writes(i);
			puts("");
			continue;
		}
		//end type 1

		//start type 2
		work();
		if(nei.empty())
			puts("-1");
		else {
			puts("2");
			for(int i=0;i<nei.size();++i)
				writes(nei[i]);
			puts("");
		}
		//end type 2
		//if(T == 2 and t == 1 and n == 100000 and m == 99974)
		//	return 0;
	}

	return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<bitset>
using namespace std;

#define P 1000007
#define N 401010
#define M 801010
#define mp make_pair
#define pb push_back
//#define M 202020
#define Inf 0x3f3f3f3f
//#define Inf 0x3f3f3f3f3f3f3f3f
//#define L (x<<1)
//#define R (x<<1|1)
//#define mid (l+r>>1)
typedef long long LL;

inline LL read() {
	LL x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return x*f;
}
inline bool num_read() {
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	return ch-'0';
}
void Write(LL x) {
	if(x<0)putchar('-'),x=-x;
	if(x>9)Write(x/10);
	putchar(x%10+48);
}
inline void writes(LL x) {Write(x),putchar(' ');}
inline void Writes(LL x) {Write(x),putchar('\n');}

int n,m,k;
int head[N],nxt[M],ver[M],Rdeg[N],deg[N],tot=1;
bool del[N],in[N];
vector <int> nei;
queue <int> q,dq;
set <pair<int,int> > graph;
vector <pair<int,int> > H[P];

inline void add(int x,int y) {ver[++tot]=y,nxt[tot]=head[x],head[x]=tot,Rdeg[y]++;}
inline int Hash(int x,int y) {LL now=0;now=1ll*x*y%P;return now%P;}
void Print() {
	cout<<"start--\n";
	for(int x=1;x<=n;++x) {
		//if(x != 23 and x != 54 and x != 41)continue ;
		if(del[x])	{printf("%d is dead\n",x);continue;}
		printf("deg[%d] is %d\n",x,deg[x]);
		for(int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			if(del[y])	continue;
			//cout<<x<<' '<<y<<endl;
		}
	}
	cout<<"end--\n";
}
void Print_nei() {
	cout<<"nei is :\n";
	for(int i=0;i<nei.size();++i)
		writes(nei[i]);
	puts("");
}
inline void Reset() {
	for(register int i=1;i<=n;++i)
		in[i]=0,head[i]=0,Rdeg[i]=0,H[i].clear();
	for(register int i=1;i<=tot;++i)
		nxt[i]=ver[i]=0;
	tot=1;
	nei.clear();
	graph.clear();
}
inline void topo() {
	while(!q.empty())
		q.pop();
	for(register int i=1;i<=n;++i)
		del[i]=0;
	for(register int i=1;i<=n;++i)
		del[i]=0,deg[i]=Rdeg[i];
	for(register int i=1;i<=n;++i)
		if(deg[i] < k)
			q.push(i),del[i]=1;
	while(!q.empty()) {
		int x=q.front();q.pop();
		for(register int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			deg[y]--;
			if(del[y])	continue;
			if(deg[y] < k)
				q.push(y),del[y]=1;
		}
	}
}
inline void Delete() {
	//printf("delete is : ");
	while(!dq.empty()) {
		int x=dq.front();dq.pop();
		//cout<<x<<' ';
		for(register int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			deg[y]--;
			if(!del[y] and deg[y] < k-1)
				dq.push(y),del[y]=1,deg[y]=-Inf;
			else if(!del[y] and !in[y] and deg[y] == k-1)
				q.push(y),in[y]=1;
		}
	}
	//puts("");
}
inline bool check() {
	//Print_nei();
	for(register int i=0;i<nei.size();++i) {
		int x=nei[i];
		for(register int j=i+1;j<nei.size();++j) {
			int y=nei[j];
			int tmp=Hash(x,y);bool f=0;
			for(register int k=0;k<H[tmp].size();++k)
				if(mp(x,y) == H[tmp][k] or mp(y,x) == H[tmp][k]) {
					f=1;
					break;
				}
			if(!f)	return 0;
		}
	}
	return true;
}
inline void work() {
	while(!q.empty())
		q.pop();
	while(!dq.empty())
		dq.pop();
	for(register int i=1;i<=n;++i)
		del[i]=0,deg[i]=Rdeg[i];
	for(register int i=1;i<=n;++i)
		if(deg[i] < k-1)
			dq.push(i),deg[i]=-Inf,del[i]=1;
		else if(deg[i] == k-1)
			q.push(i),in[i]=1;
	//puts("start");
	while(1) {
		Delete();
		//Print();
		if(q.empty())	return ;
		int x=q.front();q.pop();
		//cout<<x<<' ';
		if(del[x])	continue;
		nei.pb(x);
		for(int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			if(!del[y])
				nei.pb(y);
		}
		if(check()) {//puts("");
			return ;}
		nei.clear(),dq.push(x),deg[x]=-Inf,del[x]=1;
	}
	//puts("");
}

int main() {
	int T=read();
	for(int t=1;t<=T;++t) {
		Reset();
		n=read(),m=read(),k=read();
		//if(T == 9 and t == 6)
		//	printf("now ! data ! \n%d %d %d\n",n,m,k);
		for(int i=1,x,y;i<=m;++i) {
			x=read(),y=read();
			//if(T == 9 and t == 6) {
			//	printf("%d %d\n",x,y);
			//}
			add(x,y),add(y,x);
			H[Hash(x,y)].pb(mp(x,y));
		}
		//if(T == 4 and t != 4)	continue;
		if(k*(k-1) > 2*m) {
			puts("-1");
			continue;
		}
		//start type 1
		topo();
		int num=0;
		for(int i=1;i<=n;++i)
			if(!del[i])	num++;
		if(num) {
			writes(1),Writes(num);
			for(int i=1;i<=n;++i)
				if(!del[i])	writes(i);
			puts("");
			continue;
		}
		//end type 1

		//start type 2
		work();
		if(nei.empty())
			puts("-1");
		else {
			puts("2");
			for(int i=0;i<nei.size();++i)
				writes(nei[i]);
			puts("");
		}
		//end type 2
	}

	return 0;
}


#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<bitset>
using namespace std;

#define P 1000007
#define N 401010
#define M 801010
#define mp make_pair
#define pb push_back
//#define M 202020
#define Inf 0x3f3f3f3f
//#define Inf 0x3f3f3f3f3f3f3f3f
//#define L (x<<1)
//#define R (x<<1|1)
//#define mid (l+r>>1)
typedef long long LL;

inline LL read() {
	LL x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+(ch^48),ch=getchar();
	return x*f;
}
inline bool num_read() {
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	return ch-'0';
}
void Write(LL x) {
	if(x<0)putchar('-'),x=-x;
	if(x>9)Write(x/10);
	putchar(x%10+48);
}
inline void writes(LL x) {Write(x),putchar(' ');}
inline void Writes(LL x) {Write(x),putchar('\n');}

int n,m,k;
int head[N],nxt[M],ver[M],Rdeg[N],deg[N],tot=1;
bool del[N],in[N];
vector <int> nei;
queue <int> q,dq;
vector <pair<int,int> > H[P];

inline void add(int x,int y) {ver[++tot]=y,nxt[tot]=head[x],head[x]=tot,Rdeg[y]++;}
inline int Hash(int x,int y) {LL now=0;now=1ll*x*P%P+1ll*y%P;return now%P;}
void Print() {
	cout<<"start--\n";
	for(int x=1;x<=n;++x) {
		//if(x != 23 and x != 54 and x != 41)continue ;
		if(del[x])	{printf("%d is dead\n",x);continue;}
		printf("deg[%d] is %d\n",x,deg[x]);
		for(int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			if(del[y])	continue;
			//cout<<x<<' '<<y<<endl;
		}
	}
	cout<<"end--\n";
}
void Print_nei() {
	cout<<"nei is :\n";
	for(int i=0;i<nei.size();++i)
		writes(nei[i]);
	puts("");
}
inline void Reset() {
	for(register int i=0;i<P;++i)
		H[i].clear();
	for(register int i=1;i<=n;++i)
		in[i]=0,head[i]=0,Rdeg[i]=0;
	for(register int i=1;i<=tot;++i)
		nxt[i]=ver[i]=0;
	tot=1;
	nei.clear();
}
inline void topo() {
	while(!q.empty())
		q.pop();
	for(register int i=1;i<=n;++i)
		del[i]=0;
	for(register int i=1;i<=n;++i)
		del[i]=0,deg[i]=Rdeg[i];
	for(register int i=1;i<=n;++i)
		if(deg[i] < k)
			q.push(i),del[i]=1;
	while(!q.empty()) {
		int x=q.front();q.pop();
		for(register int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			deg[y]--;
			if(del[y])	continue;
			if(deg[y] < k)
				q.push(y),del[y]=1;
		}
	}
}
inline void Delete() {
	//printf("delete is : ");
	while(!dq.empty()) {
		int x=dq.front();dq.pop();
		//cout<<x<<' ';
		for(register int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			deg[y]--;
			if(!del[y] and deg[y] < k-1)
				dq.push(y),del[y]=1,deg[y]=-Inf;
			else if(!del[y] and !in[y] and deg[y] == k-1)
				q.push(y),in[y]=1;
		}
	}
	//puts("");
}
inline bool check() {
	//Print_nei();
	for(register int i=0;i<nei.size();++i) {
		int x=nei[i];
		for(register int j=i+1;j<nei.size();++j) {
			int y=nei[j];
			int tmp=Hash(x,y);bool f=0;
			for(register int k=0;k<H[tmp].size();++k)
				if(H[tmp][k].first == x and H[tmp][k].second == y) {
					f=1;
					break;
				}
			if(!f)	return 0;
		}
	}
	return true;
}
inline void work() {
	while(!q.empty())
		q.pop();
	while(!dq.empty())
		dq.pop();
	for(register int i=1;i<=n;++i)
		del[i]=0,deg[i]=Rdeg[i];
	for(register int i=1;i<=n;++i)
		if(deg[i] < k-1)
			dq.push(i),deg[i]=-Inf,del[i]=1;
		else if(deg[i] == k-1)
			q.push(i),in[i]=1;
	//puts("start");
	while(1) {
		Delete();
		//Print();
		if(q.empty())	return ;
		int x=q.front();q.pop();
		//cout<<x<<' ';
		if(del[x])	continue;
		nei.pb(x);
		for(int i=head[x];i;i=nxt[i]) {
			int y=ver[i];
			if(!del[y])
				nei.pb(y);
		}
		if(check()) {//puts("");
			return ;}
		nei.clear(),dq.push(x),deg[x]=-Inf,del[x]=1;
	}
	//puts("");
}

int main() {
	int T=read();
	for(int t=1;t<=T;++t) {
		Reset();
		n=read(),m=read(),k=read();
		//if(T == 9 and t == 6)
		//	printf("now ! data ! \n%d %d %d\n",n,m,k);
		for(int i=1,x,y;i<=m;++i) {
			x=read(),y=read();
			//if(T == 9 and t == 6) {
			//	printf("%d %d\n",x,y);
			//}
			add(x,y),add(y,x);
			H[Hash(x,y)].pb(mp(x,y)),H[Hash(y,x)].pb(mp(y,x));
		}
		//if(T == 4 and t != 4)	continue;
		if(k*(k-1) > 2*m) {
			puts("-1");
			continue;
		}
		//start type 1
		topo();
		int num=0;
		for(int i=1;i<=n;++i)
			if(!del[i])	num++;
		if(num) {
			writes(1),Writes(num);
			for(int i=1;i<=n;++i)
				if(!del[i])	writes(i);
			puts("");
			continue;
		}
		//end type 1

		//start type 2
		work();
		if(nei.empty())
			puts("-1");
		else {
			puts("2");
			for(int i=0;i<nei.size();++i)
				writes(nei[i]);
			puts("");
		}
		//end type 2
		if(T == 2 and t == 1 and n == 100000 and m == 99974)
			return 0;
	}

	return 0;
}