#include <bits/stdc++.h>
using namespace std;
long long mull(long long a, long long b) {
  long long res = 0;
  a %= 1000000007;
  while (b) {
    if (b & 1) res = (res + a) % 1000000007;
    a = (2 * a) % 1000000007;
    b >>= 1;
  }
  return res;
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long n, long long p) { return power(n, p - 2, p); }
struct cmp {
  bool operator()(const pair<long long, long long> &a,
                  const pair<long long, long long> &b) const {
    long long lena = a.second - a.first + 1;
    long long lenb = b.second - b.first + 1;
    if (lena == lenb) return a.first < b.first;
    return lena > lenb;
  }
};
using namespace std;
vector<long long> t[100001];
vector<set<long long> > g(100001);
map<pair<long long, long long>, long long> m1;
long long depth[100001];
bool stat[100001];
long long parent[100001][20];
void dfs(long long cur, long long prev) {
  stat[cur] = true;
  depth[cur] = depth[prev] + 1;
  parent[cur][0] = prev;
  for (long long i = 0; i < t[cur].size(); i++) {
    if (t[cur][i] != prev && stat[t[cur][i]] == false) {
      dfs(t[cur][i], cur);
      m1[{min(t[cur][i], cur), max(t[cur][i], cur)}] = 1;
    }
  }
}
void precomputeSparseMatrix(long long n) {
  for (long long i = 1; i < 20; i++) {
    for (long long node = 1; node <= n; node++) {
      if (parent[node][i - 1] != -1)
        parent[node][i] = parent[parent[node][i - 1]][i - 1];
    }
  }
}
long long lca(long long u, long long v) {
  if (depth[v] < depth[u]) swap(u, v);
  long long diff = depth[v] - depth[u];
  for (long long i = 0; i < 20; i++)
    if ((diff >> i) & 1) v = parent[v][i];
  if (u == v) return u;
  for (long long i = 20 - 1; i >= 0; i--)
    if (parent[u][i] != parent[v][i]) {
      u = parent[u][i];
      v = parent[v][i];
    }
  return parent[u][0];
}
void addEdge(long long u, long long v) {
  t[u].push_back(v);
  t[v].push_back(u);
}
void dfs1(long long u) {
  stat[u] = true;
  for (auto it : g[u]) {
    if (stat[it] == false) {
      dfs1(it);
      addEdge(u, it);
    }
  }
}
void solve() {
  long long n, m, k;
  cin >> n >> m >> k;
  for (long long i = 0; i < m; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].insert(v);
    g[v].insert(u);
  }
  memset(stat, false, sizeof(stat));
  vector<long long> head;
  for (long long i = 1; i < n + 1; i++) {
    if (stat[i] == false) {
      dfs1(i);
      head.push_back(i);
    }
  }
  long long up = k / 2;
  if (k % 2) up++;
  memset(stat, false, sizeof(stat));
  for (auto it : head) {
    dfs(it, 0);
  }
  bool fg = false;
  precomputeSparseMatrix(n);
  for (long long i = 1; i <= n; i++) {
    for (auto it : g[i]) {
      long long u = it, v = i;
      if (!m1[{min(u, v), max(u, v)}]) {
        m1[{min(u, v), max(u, v)}] = 1;
        long long l = lca(it, i);
        long long dis = depth[it] + depth[i] - 2 * depth[l];
        dis++;
        if (dis <= k) {
          cout << 2 << '\n';
          cout << dis << '\n';
          fg = true;
          vector<long long> path, path1;
          long long start = i;
          while (start != l) {
            path.push_back(start);
            start = parent[start][0];
          }
          path.push_back(l);
          start = it;
          while (start != l) {
            path1.push_back(start);
            start = parent[start][0];
          }
          reverse(path1.begin(), path1.end());
          for (auto itr : path) cout << itr << " ";
          for (auto itr : path1) cout << itr << " ";
          cout << '\n';
          break;
        }
      }
    }
    if (fg) break;
  }
  if (!fg) {
    set<pair<long long, long long> > s;
    long long cnt = 0;
    for (long long i = 1; i <= n; i++) {
      long long len = g[i].size();
      s.insert({len, i});
    }
    cout << 1 << '\n';
    while (1) {
      pair<long long, long long> tmp = *s.begin();
      cnt++;
      s.erase(s.begin());
      cout << tmp.second << " ";
      if (cnt == up) break;
      for (auto it : g[tmp.second]) {
        long long len = g[it].size();
        if (s.find({len, it}) != s.end()) {
          for (auto itr : g[it]) {
            long long ll = g[itr].size();
            if (g[itr].find(it) != g[itr].end()) {
              if (itr != tmp.second) g[itr].erase(g[itr].find(it));
            }
            if (s.find({ll, itr}) != s.end()) {
              pair<long long, long long> tt = *s.find({ll, itr});
              s.erase(s.find({ll, itr}));
              s.insert({tt.first - 1, tt.second});
            }
          }
          s.erase(s.find({len, it}));
        }
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
