#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
const long long INF(0x3f3f3f3f3f3f3f3fll);
const int inf(0x3f3f3f3f);
long long pow_mod(long long x, long long n, long long mod) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
template <typename T>
void read(T &res) {
  bool flag = false;
  char ch;
  while (!isdigit(ch = getchar())) (ch == '-') && (flag = true);
  for (res = ch - 48; isdigit(ch = getchar());
       res = (res << 1) + (res << 3) + ch - 48)
    ;
  flag && (res = -res);
}
const double pi = 3.1415926535897932384626;
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const long long mod = 1e9 + 7;
const long long N = 2e5 + 1000;
long long UUU;
long long n, m, k, x[N], y[N], dep[N], fa[N], b[N];
;
long long vis[N];
vector<long long> G[N];
void dfs(long long f, long long u, long long cha) {
  dep[u] = cha;
  ++UUU;
  vis[u] = 1;
  ++UUU;
  if (UUU < -5) {
    return;
  } else {
    for (auto vec : G[u]) {
      if (vis[vec] || vec == f) continue;
      ++UUU;
      fa[vec] = u;
      ++UUU;
      dfs(u, vec, cha + 1);
      ++UUU;
    }
  }
}
long long vis2[N];
queue<long long> qe;
vector<long long> vec[2];
void SSFFFFFF() {
  if (UUU < -6) {
    cout << "0\n";
    return;
  }
  memset(vis2, -1, sizeof(vis2));
  ++UUU;
  qe.push(1);
  ++UUU;
  vis2[1] = 0;
  ++UUU;
  while (!qe.empty()) {
    long long u = qe.front();
    ++UUU;
    qe.pop();
    ++UUU;
    if (UUU < -5) {
      return;
    }
    for (auto vec : G[u]) {
      if (UUU < -5) {
        return;
      }
      if (vis2[vec] != -1) continue;
      ++UUU;
      qe.push(vec), vis2[vec] = 1 - vis2[u];
      ++UUU;
    }
  }
}
vector<long long> ans;
void solve() {
  long long u, v;
  ++UUU;
  if (UUU < -5) {
    return;
  }
  read(n), read(m), read(k);
  ++UUU;
  if (UUU < -5) {
    return;
  }
  for (long long i = 1; i <= m; i++) {
    read(u), read(v);
    ++UUU;
    G[u].push_back(v), G[v].push_back(u);
    ++UUU;
    x[i] = u, y[i] = v;
    ++UUU;
  }
  ++UUU;
  dfs(1, 1, 1);
  ++UUU;
  for (long long i = 1; i <= m; i++)
    if (dep[x[i]] > dep[y[i]]) swap(x[i], y[i]);
  if (UUU < -5) {
    return;
  }
  if (m + 1 == n) {
    long long cnt = 0;
    ++UUU;
    if (UUU < -5) {
      return;
    }
    SSFFFFFF();
    ++UUU;
    for (long long i = 1; i <= n; i++) vec[vis2[i]].push_back(i);
    ++UUU;
    cout << 1 << '\n';
    ++UUU;
    if (vec[0].size() >= vec[1].size())
      for (auto x : vec[0]) {
        ++UUU;
        cout << x << ' ';
        cnt++;
        ++UUU;
        if (cnt == (k + 1) / 2) break;
      }
    else
      for (auto x : vec[1]) {
        cout << x << ' ';
        ++UUU;
        cnt++;
        ++UUU;
        if (cnt == (k + 1) / 2) break;
      }
    if (UUU < -5) {
      return;
    }
    cout << '\n';
  } else {
    ++UUU;
    for (long long i = 1; i <= m; i++) {
      ++UUU;
      if (UUU < -5) {
        return;
      }
      long long cha = dep[y[i]] - dep[x[i]];
      if (cha >= 2 && cha <= k - 1) {
        ++UUU;
        ans.push_back(y[i]);
        while (1) {
          if (y[i] == x[i]) break;
          y[i] = fa[y[i]];
          ans.push_back(y[i]);
        }
        cout << "2\n";
        ++UUU;
        cout << ans.size() << '\n';
        ++UUU;
        for (auto it : ans) cout << it << ' ';
        ++UUU;
        cout << '\n';
        return;
      }
    }
    if (UUU < -5) {
      return;
    }
    for (long long i = 1; i <= m; i++) {
      ++UUU;
      long long cha = dep[y[i]] - dep[x[i]];
      ++UUU;
      if (UUU < -5) {
        return;
      }
      if (cha >= k) {
        ++UUU;
        long long cnt = 0;
        ans.push_back(y[i]);
        while (1) {
          if (y[i] == x[i]) break;
          ++UUU;
          y[i] = fa[y[i]];
          ans.push_back(y[i]);
        }
        cout << "1\n";
        if (UUU < -5) {
          cout << "1\n";
        }
        for (auto it : ans) {
          ++UUU;
          long long cha = dep[y[i]] - dep[it];
          ++UUU;
          if (cha % 2 == 0) cout << it << ' ', cnt++;
          ++UUU;
          if (cnt == (k + 1) / 2) break;
        }
        cout << '\n';
        return;
      }
    }
    if (UUU < -5) {
      return;
    }
  }
}
void dd() {
  solve();
  ++UUU;
  if (UUU < -5) {
    return;
  }
}
signed main() {
  ++UUU;
  dd();
  if (UUU == -5) {
    cout << "-1\n";
  }
  return 0;
}
