#include <queue>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
typedef long long LL;
typedef vector<int> vi;
#define FOR(i, n) for(int i = 0; i < (int)(n); ++i)

const int inf = 1 << 29;

struct MinCost
{
	int n, s, t;
	struct edge
	{
		int a, b, cost, cap, next;
	};
	vector<edge> e;
	vi g, d, p, f, flag;
	void SetN(int nn)
	{
		n = nn;
		s = n - 1;
		t = n - 2;
		g.assign(n, 0);
		p.assign(n, 0);
		f.assign(n, 0);
		flag.assign(n, 0);
		e.resize(2);
	}
	void AddE(int a, int b, int cap, int cost)
	{
		edge ee;

		ee.a = a;
		ee.b = b;
		ee.cap = cap;
		ee.cost = cost;
		ee.next = g[a];
		g[a] = e.size();
		e.push_back(ee);

		ee.a = b;
		ee.b = a;
		ee.cap = 0;
		ee.cost = -cost;
		ee.next = g[b];
		g[b] = e.size();
		e.push_back(ee);
	}
	bool Dij()
	{
		flag.assign(n, 0);
		d.assign(n, inf);
		d[s] = 0;
		while (1)
		{
			int Min = inf;
			int x = -1;
			FOR(i, n)
				if (!flag[i] && Min > d[i])
				{
					Min = d[i];
					x = i;
				}
			if (Min == inf) break;
			flag[x] = 1;
			for (int r = g[x]; r; r = e[r].next)
				if (e[r].cap > 0)
					if (d[e[r].b] > Min + f[e[r].a] - f[e[r].b] + e[r].cost)
					{
						d[e[r].b] = Min + f[e[r].a] - f[e[r].b] + e[r].cost;
						p[e[r].b] = r;
						flag[e[r].b] = 0;
					}
		}
		FOR(i, n)
			f[i] = min(inf, f[i] + d[i]);
		return d[t] != inf;
	}
	void Aug()
	{
		int x = t;
		while (x != s)
		{
			int r = p[x];
			e[r].cap--;
			e[r ^ 1].cap++;
			x = e[r].a;
		}
	}
	int Calc()
	{
		while (Dij())
			Aug();
		int res = 0;
		for (int r = 3; r < e.size(); r += 2)
			res -= e[r].cap * e[r].cost;
		return res;
	}
};

MinCost mc;
char s[1 << 20];

int main()
{
	int a;
	scanf("%d", &a);
	scanf("%s", s);
	int zn = 1;
	vi v;
	vi vt;
	int p = 0;
	int len = strlen(s);
	while (p < len)
	{
		int x = 1;
		if (s[p] >= '0' && s[p] <= '9')
		{
			x = 0;
			while (s[p] >= '0' && s[p] <= '9')
			{
				x = x * 10 + s[p] - '0';
				p++;
			}
			p++;
		}
		x = x * zn;
		v.push_back(x);
		vt.push_back(s[p] != 'a');
		p += 3;
		if (p < len)
		{
			if (s[p] == '+')
				zn = 1;
			else
				zn = -1;
			p++;
		}
	}
	mc.SetN(v.size() * 2 + 10);

	FOR(i, v.size())
	{
		mc.AddE(mc.s, i, 1, 0);
		mc.AddE(v.size() + i, mc.t, 1, 0);
	}
	FOR(i, v.size())
		FOR(j, v.size())
			mc.AddE(i, v.size() + j, 1, -v[i] * (a + j + vt[i]));

	int res = -mc.Calc();

	printf("%d\n", res);

	return 0;
}


#include <queue>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;
typedef long long LL;
typedef vector<int> vi;
#define FOR(i, n) for(int i = 0; i < (int)(n); ++i)

const int inf = 1 << 29;

struct MinCost
{
	int n, s, t;
	struct edge
	{
		int a, b, cost, cap, next;
	};
	vector<edge> e;
	vi g, d, p, f, flag;
	void SetN(int nn)
	{
		n = nn;
		s = n - 1;
		t = n - 2;
		g.assign(n, 0);
		d.assign(n, 0);
		p.assign(n, 0);
		f.assign(n, 0);
		flag.assign(n, 0);
		e.resize(2);
	}
	void AddE(int a, int b, int cap, int cost)
	{
		edge ee;

		ee.a = a;
		ee.b = b;
		ee.cap = cap;
		ee.cost = cost;
		ee.next = g[a];
		g[a] = e.size();
		e.push_back(ee);

		ee.a = b;
		ee.b = a;
		ee.cap = 0;
		ee.cost = -cost;
		ee.next = g[b];
		g[b] = e.size();
		e.push_back(ee);
	}
	bool Dij(vi& f, vi&d)
	{
		flag.assign(n, 0);
		d.assign(n, inf);
		d[s] = 0;
		//set<pair<int, int> > q;
		//q.insert(make_pair(0, s));
		int cnt = 0;
		while (1)
		{
			cnt++;
			if (cnt > 5000)
				++*(int*)0;
			int Min = inf;
			int x = -1;
			FOR(i, n)
				if (!flag[i] && Min > d[i])
				{
					Min = d[i];
					x = i;
				}
			if (Min == inf) break;
			//int Min = q.begin()->first;
			//int x = q.begin()->second;
			//q.erase(q.begin());
			flag[x] = 1;
			for (int r = g[x]; r; r = e[r].next)
				if (e[r].cap > 0)
					if (d[e[r].b] > Min + f[e[r].a] - f[e[r].b] + e[r].cost)
					{
//						q.erase(make_pair(d[e[r].b], e[r].b));
						d[e[r].b] = Min + f[e[r].a] - f[e[r].b] + e[r].cost;
//						q.insert(make_pair(d[e[r].b], e[r].b));
						p[e[r].b] = r;
						//flag[e[r].b] = 0;
					}
		}
		FOR(i, n)
			f[i] = min(inf, f[i] + d[i]);
		return d[t] != inf;
	}
	void Aug()
	{
		int x = t;
		while (x != s)
		{
			int r = p[x];
			e[r].cap--;
			e[r ^ 1].cap++;
			x = e[r].a;
		}
	}
	int Calc()
	{
		Dij(d, f);
		int dcc = 0;
		while (Dij(f, d))
		{
			Aug();
			dcc++;
			if (dcc > 250) throw 1;
		}
		int res = 0;
		for (int r = 3; r < e.size(); r += 2)
			res -= e[r].cap * e[r].cost;
		return res;
	}
};

MinCost mc;
char s[1 << 20];

int main()
{
	int a;
	scanf("%d", &a);
	scanf("%s", s);
	int zn = 1;
	vi v;
	vi vt;
	int p = 0;
	int len = strlen(s);
	while (p < len)
	{
		int x = 1;
		if (s[p] >= '0' && s[p] <= '9')
		{
			x = 0;
			while (s[p] >= '0' && s[p] <= '9')
			{
				x = x * 10 + s[p] - '0';
				p++;
			}
			p++;
		}
		x = x * zn;
		v.push_back(x);
		vt.push_back(s[p] != 'a');
		p += 3;
		if (p < len)
		{
			if (s[p] == '+')
				zn = 1;
			else
				zn = -1;
			p++;
		}
	}
	mc.SetN(v.size() * 2 + 2);
	mc.e.reserve(v.size() * v.size() * 4);

	FOR(i, v.size())
	{
		mc.AddE(mc.s, i, 1, 1);
		mc.AddE(v.size() + i, mc.t, 1, 1);
	}
	FOR(i, v.size())
		FOR(j, v.size())
			mc.AddE(i, v.size() + j, 1, -v[i] * (a + j + vt[i]) + 2000000);

	int res = -mc.Calc() + v.size() * 2 + 2000000 * v.size();

	printf("%d\n", res);

	return 0;
}


#include <queue>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
typedef long long LL;
typedef vector<int> vi;
#define FOR(i, n) for(int i = 0; i < (int)(n); ++i)

const int inf = 1 << 29;

struct MinCost
{
	int n, s, t;
	struct edge
	{
		int a, b, cost, cap, next;
	};
	vector<edge> e;
	vi g, d, p, f, flag;
	void SetN(int nn)
	{
		n = nn;
		s = n - 1;
		t = n - 2;
		g.assign(n, 0);
		p.assign(n, 0);
		f.assign(n, 0);
		flag.assign(n, 0);
		e.resize(2);
	}
	void AddE(int a, int b, int cap, int cost)
	{
		edge ee;

		ee.a = a;
		ee.b = b;
		ee.cap = cap;
		ee.cost = cost;
		ee.next = g[a];
		g[a] = e.size();
		e.push_back(ee);

		ee.a = b;
		ee.b = a;
		ee.cap = 0;
		ee.cost = -cost;
		ee.next = g[b];
		g[b] = e.size();
		e.push_back(ee);
	}
	bool Dij()
	{
		flag.assign(n, 0);
		d.assign(n, inf);
		d[s] = 0;
		while (1)
		{
			int Min = inf;
			int x = -1;
			FOR(i, n)
				if (!flag[i] && Min > d[i])
				{
					Min = d[i];
					x = i;
				}
			if (Min == inf) break;
			flag[x] = 1;
			for (int r = g[x]; r; r = e[r].next)
				if (e[r].cap > 0)
					if (d[e[r].b] > Min + f[e[r].a] - f[e[r].b] + e[r].cost)
					{
						d[e[r].b] = Min + f[e[r].a] - f[e[r].b] + e[r].cost;
						p[e[r].b] = r;
						flag[e[r].b] = 0;
					}
		}
		FOR(i, n)
			f[i] = min(inf, f[i] + d[i]);
		return d[t] != inf;
	}
	void Aug()
	{
		int x = t;
		while (x != s)
		{
			int r = p[x];
			e[r].cap--;
			e[r ^ 1].cap++;
			x = e[r].a;
		}
	}
	int Calc()
	{
		while (Dij())
			Aug();
		int res = 0;
		for (int r = 3; r < e.size(); r += 2)
			res -= e[r].cap * e[r].cost;
		return res;
	}
};

MinCost mc;
char s[1 << 20];

int main()
{
	int a;
	scanf("%d", &a);
	scanf("%s", s);
	int zn = 1;
	vi v;
	vi vt;
	int p = 0;
	int len = strlen(s);
	while (p < len)
	{
		int x = 1;
		if (s[p] >= '0' && s[p] <= '9')
		{
			x = 0;
			while (s[p] >= '0' && s[p] <= '9')
			{
				x = x * 10 + s[p] - '0';
				p++;
			}
			p++;
		}
		x = x * zn;
		v.push_back(x);
		vt.push_back(s[p] != 'a');
		p += 3;
		if (p < len)
		{
			if (s[p] == '+')
				zn = 1;
			else
				zn = -1;
			p++;
		}
	}
	mc.SetN(v.size() * 2 + 2);
	mc.e.reserve(v.size() * v.size() * 4);

	FOR(i, v.size())
	{
		mc.AddE(mc.s, i, 1, 0);
		mc.AddE(v.size() + i, mc.t, 1, 0);
	}
	FOR(i, v.size())
		FOR(j, v.size())
			mc.AddE(i, v.size() + j, 1, -v[i] * (a + j + vt[i]));

	int res = -mc.Calc();

	printf("%d\n", res);

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fore(i, l, r) for (int i = int(l); i < int(r); i++)
#define all(a) a.begin(), a.end()
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) a.size()
#define ft first
#define sc second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll a;
	cin >> a;
	string s;
	cin >> s;
	vector<pll> coef;
	ll i = 0;
	ll cur_c = 1;

	while (i < s.length()) {
		if (s[i] <= '9' && s[i] >= '0') {
			bool is_m = false;
			if (cur_c < 0) {
				is_m = true;
				cur_c *= -1;
			}
			cur_c *= s[i] - '0';
			i++;
			while (s[i] != '*') {
				cur_c *= 10;
				cur_c += s[i] - '0';
				i++;
			}
			i++;
			if (is_m)
				cur_c *= -1;
			coef.pb(mp(cur_c, -1));
			cur_c = 1;
			continue;
		}
		if (s[i] == '-') {
			cur_c *= -1;
			i++;
			if (!(s[i] <= '9' && s[i] >= '0')) {
				coef.pb(mp(cur_c, -1));
				cur_c = 1;
			}
			continue;
		}
		if (s[i] == 'a') {
			if (i > 1 && s[i - 1] == '+' && s[i - 2] == '+' &&
				!(i > 3 && s[i - 4] == 'a' && !(i > 5 && s[i - 5] == '+' && s[i - 6] == '+'))) {
				if (sz(coef) && coef[sz(coef) - 1].sc == -1)
					coef[sz(coef) - 1].sc = 1;
				else coef.pb(mp(1, 1));
				i++;
			}
			else {
				if (sz(coef) && coef[sz(coef) - 1].sc == -1)
					coef[sz(coef) - 1].sc = 0;
				else coef.pb(mp(1, 0));
				i += 3;
			}
			continue;
		}
		if (s[i] == '+')
			i++;
	}

	sort(all(coef));
	ll result = 0;
	if (a == 97)
		result -= 26;
	forn(i, sz(coef)) {
		result += coef[i].ft * (a + coef[i].sc);
		a++;
	}

	cout << result << endl;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fore(i, l, r) for (int i = int(l); i < int(r); i++)
#define all(a) a.begin(), a.end()
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) a.size()
#define ft first
#define sc second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll a;
	cin >> a;
	string s;
	cin >> s;
	vector<pll> coef;
	ll i = 0;
	ll cur_c = 1;

	while (i < s.length()) {
		if (s[i] <= '9' && s[i] >= '0') {
			bool is_m = false;
			if (cur_c < 0) {
				is_m = true;
				cur_c *= -1;
			}
			cur_c *= s[i] - '0';
			i++;
			while (s[i] != '*') {
				cur_c *= 10;
				cur_c += s[i] - '0';
				i++;
			}
			i++;
			if (is_m)
				cur_c *= -1;
			coef.pb(mp(cur_c, -1));
			cur_c = 1;
			continue;
		}
		if (s[i] == '-') {
			cur_c *= -1;
			i++;
			if (!(s[i] <= '9' && s[i] >= '0')) {
				coef.pb(mp(cur_c, -1));
				cur_c = 1;
			}
			continue;
		}
		if (s[i] == 'a') {
			if (i > 1 && s[i - 1] == '+' && s[i - 2] == '+' &&
				!(i > 3 && s[i - 4] == 'a' && !(i > 5 && s[i - 5] == '+' && s[i - 6] == '+'))) {
				if (sz(coef) && coef[sz(coef) - 1].sc == -1)
					coef[sz(coef) - 1].sc = 1;
				else coef.pb(mp(1, 1));
				i++;
			}
			else {
				if (sz(coef) && coef[sz(coef) - 1].sc == -1)
					coef[sz(coef) - 1].sc = 0;
				else coef.pb(mp(1, 0));
				i += 3;
			}
			continue;
		}
		if (s[i] == '+')
			i++;
	}

	sort(all(coef));
	ll result = 0;
	forn(i, sz(coef)) {
		result += coef[i].ft * (a + coef[i].sc);
		a++;
	}

	cout << result << endl;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fore(i, l, r) for (int i = int(l); i < int(r); i++)
#define all(a) a.begin(), a.end()
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) a.size()
#define ft first
#define sc second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll a;
	cin >> a;
	string s;
	cin >> s;
	vector<pll> coef;
	ll i = 0;
	ll cur_c = 1;

	while (i < s.length()) {
		if (s[i] <= '9' && s[i] >= '0') {
			bool is_m = false;
			if (cur_c < 0) {
				is_m = true;
				cur_c *= -1;
			}
			cur_c *= s[i] - '0';
			i++;
			while (s[i] != '*') {
				cur_c *= 10;
				cur_c += s[i] - '0';
				i++;
			}
			i++;
			if (is_m)
				cur_c *= -1;
			coef.pb(mp(cur_c, -1));
			cur_c = 1;
			continue;
		}
		if (s[i] == '-') {
			cur_c *= -1;
			i++;
			if (!(s[i] <= '9' && s[i] >= '0')) {
				coef.pb(mp(cur_c, -1));
				cur_c = 1;
			}
			continue;
		}
		if (s[i] == 'a') {
			if (i > 1 && s[i - 1] == '+' && s[i - 2] == '+') {
				if (sz(coef) && coef[sz(coef) - 1].sc == -1)
					coef[sz(coef) - 1].sc = 1;
				else coef.pb(mp(1, 1));
				i++;
			}
			else {
				if (sz(coef) && coef[sz(coef) - 1].sc == -1)
					coef[sz(coef) - 1].sc = 0;
				else coef.pb(mp(1, 0));
				i += 3;
			}
			continue;
		}
		if (s[i] == '+')
			i++;
	}

	sort(all(coef));
	ll result = 0;
	forn(i, sz(coef)) {
		result += coef[i].ft * (a + coef[i].sc);
		a++;
	}

	cout << result << endl;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fore(i, l, r) for (int i = int(l); i < int(r); i++)
#define all(a) a.begin(), a.end()
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) a.size()
#define ft first
#define sc second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll a;
	cin >> a;
	string s;
	cin >> s;
	vector<pll> coef;
	ll i = 0;
	ll cur_c = 1;

	while (i < s.length()) {
		if (s[i] <= '9' && s[i] >= '0') {
			bool is_m = false;
			if (cur_c < 0) {
				is_m = true;
				cur_c *= -1;
			}
			cur_c *= s[i] - '0';
			i++;
			while (s[i] != '*') {
				cur_c *= 10;
				cur_c += s[i] - '0';
				i++;
			}
			i++;
			if (is_m)
				cur_c *= -1;
			coef.pb(mp(cur_c, -1));
			cur_c = 1;
			continue;
		}
		if (s[i] == '-') {
			cur_c *= -1;
			i++;
			if (!(s[i] <= '9' && s[i] >= '0')) {
				coef.pb(mp(cur_c, -1));
				cur_c = 1;
			}
			continue;
		}
		if (s[i] == 'a') {
			if (i > 1 && s[i - 1] == '+' && s[i - 2] == '+' /*&& !(i > 3 && s[i - 4] == 'a')*/) {
				if (sz(coef) && coef[sz(coef) - 1].sc == -1)
					coef[sz(coef) - 1].sc = 1;
				else coef.pb(mp(1, 1));
				i++;
			}
			else {
				if (sz(coef) && coef[sz(coef) - 1].sc == -1)
					coef[sz(coef) - 1].sc = 0;
				else coef.pb(mp(1, 0));
				i += 3;
			}
			continue;
		}
		if (s[i] == '+')
			i++;
	}

	sort(all(coef));
	ll result = 0;
	forn(i, sz(coef)) {
		result += coef[i].ft * (a + coef[i].sc);
		a++;
	}

	cout << result << endl;
}


#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>

#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fore(i, l, r) for (int i = int(l); i < int(r); i++)
#define all(a) a.begin(), a.end()
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) a.size()
#define ft first
#define sc second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ld, ld> pld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll a;
	cin >> a;
	string s;
	cin >> s;
	vector<pll> coef;
	ll i = 0;
	ll cur_c = 1;

	while (i < s.length()) {
		if (s[i] <= '9' && s[i] >= '0') {
			bool is_m = false;
			if (cur_c < 0) {
				is_m = true;
				cur_c *= -1;
			}
			cur_c *= s[i] - '0';
			i++;
			while (s[i] != '*') {
				cur_c *= 10;
				cur_c += s[i] - '0';
				i++;
			}
			i++;
			if (is_m)
				cur_c *= -1;
			coef.pb(mp(cur_c, -1));
			cur_c = 1;
			continue;
		}
		if (s[i] == '-') {
			cur_c *= -1;
			i++;
			if (!(s[i] <= '9' && s[i] >= '0')) {
				coef.pb(mp(cur_c, -1));
				cur_c = 1;
			}
			continue;
		}
		if (s[i] == 'a') {
			if (i > 1 && s[i - 1] == '+' && s[i - 2] == '+' && !(i > 3 && s[i - 4] == 'a')) {
				if (sz(coef) && coef[sz(coef) - 1].sc == -1)
					coef[sz(coef) - 1].sc = 1;
				else coef.pb(mp(1, 1));
				i++;
			}
			else {
				if (sz(coef) && coef[sz(coef) - 1].sc == -1)
					coef[sz(coef) - 1].sc = 0;
				else coef.pb(mp(1, 0));
				i += 3;
			}
			continue;
		}
		if (s[i] == '+')
			i++;
	}

	sort(all(coef));
	ll result = 0;
	forn(i, sz(coef)) {
		result += coef[i].ft * (a + coef[i].sc);
		a++;
	}

	cout << result << endl;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <Windows.h>
#include <string>
#include <cctype>

using namespace std;

bool cmp (pair <int, bool> a, pair <int, bool> b) {
    return a.first < b.first;
}

int main () {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int a = 0;
    string expr = "";
    cin >> a >> expr;
    vector <pair <int, bool> > number;
    bool sign = false; // + == false; - == true
    for (int i = 0; i < expr.length(); ) {
        int coef = 0;
        if (!isdigit(expr[i])) {
            coef = 1;
        } else {
            while (isdigit(expr[i])) {
                coef = expr[i] - '0' + coef * 10;
                ++i;
            }
            ++i;
        }
        coef = (sign == false ? coef : -coef);

        bool inc = (expr[i] == '+' ? true : false);
        number.push_back (make_pair (coef, inc));
        i += 3;
        if (i < expr.length()) {
            sign = (expr[i] == '-' ? true : false);
        }
        ++i;
    }
    sort(number.begin(), number.end(), cmp);
    int ans = 0;
    for (int i = 0; i < number.size(); ++i) {
        ans += number[i].first * a;
        if (number[i].second == true) {
            ans += number[i].first;
        }
        ++a;
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int SIZE = 200200;

vector <int> g[SIZE];
int g1[SIZE];
vector <int> ans[SIZE];
bool used[SIZE];
int tn = 0;
int tk = 0;
int maxk;

void dfs(int v, int pr) {
    used[v] = true;
    //cout << 555555 << " " << v << " " << tn << " " << tk << "\n";
    ans[tn].push_back(v);
    tk++;
    if (tk == maxk) {
        tn++;
        tk = 1;
    }
    for (int u : g[v]) {
        if (!used[u]) {
            dfs(u, v);
            tk++;
            ans[tn].push_back(v);
            if (tk == maxk) {
                tn++;
                tk = 1;
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    int n, m, k, a, b;
    cin >> n >> m >> k;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }
    maxk = (2 * n - 1) / k + 1;
    //cout << maxk << "\n";
    dfs(0, -1);
    for (int i = 0; i < k; i++) {
        if (ans[i].size() == 0) {
            ans[i].push_back(0);
        }
    }
    for (int i = 0; i < k; i++) {
        cout << ans[i].size() << " ";
        for (int z : ans[i]) {
            cout << z + 1 << " ";
        }
        cout << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int SIZE = 200200;

vector <int> g[SIZE];
int g1[SIZE];
vector <int> ans[SIZE];
bool used[SIZE];
int tn = 0;
int tk = 0;
int maxk;

void dfs(int v, int pr) {
    used[v] = true;
    //cout << 555555 << " " << v << " " << tn << " " << tk << "\n";
    ans[tn].push_back(v);
    tk++;
    if (tk == maxk) {
        tn++;
        tk = 1;
    }
    for (int u : g[v]) {
        if (!used[u]) {
            dfs(u, v);
            tk++;
            ans[tn].push_back(v);
            if (tk == maxk) {
                tn++;
                tk = 1;
            }
        }
    }
}

int main()
{
    int n, m, k, a, b;
    cin >> n >> m >> k;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }
    maxk = (2 * n - 1) / k + 1;
    cout << maxk << "\n";
    dfs(0, -1);
    for (int i = 0; i < k; i++) {
        if (ans[i].size() == 0) {
            ans[i].push_back(0);
        }
    }
    for (int i = 0; i < k; i++) {
        cout << ans[i].size() << " ";
        for (int z : ans[i]) {
            cout << z + 1 << " ";
        }
        cout << "\n";
    }
    return 0;
}


/* Задача Е, Воронин Илья */

#include <bits/stdc++.h>

using namespace std;

const int SIZE = 200200;

vector <int> g[SIZE];
int g1[SIZE];
vector <int> ans[SIZE];
bool used[SIZE];
int tn = 0;
int tk = 0;
int maxk;

void dfs(int v, int pr) {
    used[v] = true;
    ans[tn].push_back(v);
    tk++;
    //cout << 555555 << " " << v << " " << tn << " " << tk << "\n";
    if (tk == maxk) {
        tn++;
        tk = 0;
    }
    for (int u : g[v]) {
        if (!used[u]) {
            dfs(u, v);
            tk++;
            ans[tn].push_back(v);
            //cout << 666666 << " " << v << " " << tn << " " << tk << "\n";
            if (tk == maxk) {
                tn++;
                tk = 0;
            }
        }
    }
}

int main()
{
    int n, m, k, a, b;
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 0; i < m; i++) {
        scanf("%d%d", &a, &b);
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }
    maxk = (2 * n - 1) / k + 1;
    //cout << maxk << "\n";
    dfs(0, -1);
    for (int i = 0; i < k; i++) {
        if (ans[i].size() == 0) {
            ans[i].push_back(0);
        }
    }
    for (int i = 0; i < k; i++) {
        printf("%d ", int(ans[i].size()));
        for (int z : ans[i]) {
            printf("%d ", z + 1);
        }
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int SIZE = 200200;

vector <int> g[SIZE];
int g1[SIZE];
vector <int> ans[SIZE];
bool used[SIZE];
int tn = 0;
int tk = 0;
int maxk;

void dfs(int v, int pr) {
    used[v] = true;
    ans[tn].push_back(v);
    tk++;
    //cout << 555555 << " " << v << " " << tn << " " << tk << "\n";
    if (tk == maxk) {
        tn++;
        tk = 1;
    }
    for (int u : g[v]) {
        if (!used[u]) {
            dfs(u, v);
            tk++;
            ans[tn].push_back(v);
            //cout << 666666 << " " << v << " " << tn << " " << tk << "\n";
            if (tk == maxk) {
                tn++;
                tk = 0;
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    int n, m, k, a, b;
    cin >> n >> m >> k;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        g[a - 1].push_back(b - 1);
        g[b - 1].push_back(a - 1);
    }
    maxk = (2 * n - 1) / k + 1;
    //cout << maxk << "\n";
    dfs(0, -1);
    for (int i = 0; i < k; i++) {
        if (ans[i].size() == 0) {
            ans[i].push_back(0);
        }
    }
    for (int i = 0; i < k; i++) {
        cout << ans[i].size() << " ";
        for (int z : ans[i]) {
            cout << z + 1 << " ";
        }
        cout << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n, m, K, k, t, nr, r, l, path[500005], x, y;
vector< int > a[500005];
bitset<500005> w;

void dfs( int nod )
{
    w[ nod ] = 1;
    path[ ++k ] = nod;
    vector< int > :: iterator it;
    for( it = a[ nod ].begin(); it != a[ nod ].end(); ++ it )
        if( !w[ *it ] )
        {
            dfs( *it );
            path[ ++ k ] = nod;
        }
}

int main()
{
    ios::sync_with_stdio(false);
	cin.tie(0);
    cin >> n >> m >> K;
    for( int i = 1; i <= m; ++ i )
    {
       cin >> x >> y;
       a[ x ].push_back( y );
       a[ y ].push_back( x );
    }
    dfs( 1 );
    r = k % K;
    for( int i = 0; i < K; ++ i )
    {
        nr = k / K;
        if( i < r ) nr ++;
        cout << nr << " ";
        for( int j = 0; j < nr; ++ j )
            cout << path[ ++ l ] << " ";
        cout << '\n';
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n, m, K, k, t, nr, r, l, path[500005], x, y;
vector< int > a[500005];
bitset<500005> w;

void dfs( int nod )
{
    w[ nod ] = 1;
    path[ ++k ] = nod;
    vector< int > :: iterator it;
    for( it = a[ nod ].begin(); it != a[ nod ].end(); ++ it )
        if( !w[ *it ] )
        {
            dfs( *it );
            path[ ++ k ] = nod;
        }
}

int main()
{
    cin >> n >> m >> K;
    for( int i = 1; i <= m; ++ i )
    {
       cin >> x >> y;
       a[ x ].push_back( y );
       a[ y ].push_back( x );
    }
    dfs( 1 );
    r = k % K;
    for( int i = 0; i < K; ++ i )
    {
        nr = k / K;
        if( i < r ) nr ++;
        cout << nr << " ";
        for( int j = 0; j < nr; ++ j )
            cout << path[ ++ l ] << " ";
        cout << '\n';
    }
    return 0;
}


//يدا عرضك والله صعبة
#include<bits/stdc++.h>
#define f first
#define s second
#define OO 1e18
#define ll long long
#define pb push_back
#define mp make_pair
#define Mod 1000000007
using namespace std;
const ll Max=1e6+ 7;
vector<int> adj[Max];
bool vis[Max];
int num,path[Max*2],c,n,m,k;
void dfs(int u)
{
	path[++num]= u;
	vis[u]=true;
	for(int i=0;i<adj[u].size();i++)
        {
	    int v= adj[u][i];

		if(!vis[v])
        {
			dfs(v);
            path[++num]= u;
		}
	}
}

int main()
{
     ios_base::sync_with_stdio(0);
      cin.tie(0);
	cin>>n>>m>>k;
	for(int i=0;i<m;++i)
		{
		    int x,y;
		    cin>>x>>y;
		adj[x].push_back(y);
		adj[y].push_back(x);
		}

	dfs(1);
	int u=1;

	int rem= num%k;

	for(int i=0;i<k;i++)
        {
		c= num/k;

		if(i<rem)
            ++c;
		cout<<c<<' ';

		for(int j=0;j<c;j++)
		cout<<path[u++]<<' ';
		cout<<endl;
 	    }
}


#include <bits/stdc++.h>

using namespace std;

#define fr first
#define sc second
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int maxn = 1e3 + 55;
const int inf = 1e9;
const int base = 1e9 + 9;
const double eps = 1e-7;

int k, n, m, len;
vector<int> a[maxn];
bool used[maxn];
vector<int> q;

void dfs(int v){
    used[v] = 1;
    q.pb(v);
    for(int i = 0; i < a[v].size(); i++)
        if(!used[a[v][i]]){
            dfs(a[v][i]);
            q.pb(v);
        }
    if(q.back() != v)
        q.pb(v);

}

vector<int> nxt[maxn];
int d[maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> k;
    for(int i = 0; i < m; i++){
        int v, u, t;
        cin >> v >> u;
        v--;
        u--;
        a[v].pb(u);
        a[u].pb(v);
    }
    len = (2*n + k - 1)/k;
    dfs(0);
    for(int i = 0; i < q.size(); i++){
        nxt[q[i]].pb(i);
    }
    for(int i = 0; i < n; i++){
        used[i] = 0;
        d[i] = 0;
        nxt[i].pb(q.size() + 1);
    }
    for(int i = 0; i < q.size(); i++){
        while(nxt[q[i]][d[q[i]]] <= i)
            d[q[i]]++;
        if(nxt[q[i]][d[q[i]]] >= i + len || nxt[q[i]][d[q[i]]] > q.size()){
            int j = 0;
            cout << min(len, (int)q.size() - i) << " ";
            for(j = i; j < i + len && j < q.size(); j++){
                cout << q[j] + 1  << " ";
            }
            cout << "\n";
            i = j;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define fr first
#define sc second
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int maxn = 2e5 + 55;
const int inf = 1e9;
const int base = 1e9 + 9;
const double eps = 1e-7;

int k, n, m, len;
vector<int> a[maxn];
bool used[maxn];
vector<int> q;

void dfs(int v){
    used[v] = 1;
    q.pb(v);
    for(int i = 0; i < a[v].size(); i++)
        if(!used[a[v][i]]){
            dfs(a[v][i]);
            q.pb(v);
        }
    if(q.back() != v)
        q.pb(v);

}

vector<int> nxt[maxn];
int d[maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> k;
    for(int i = 0; i < m; i++){
        int v, u, t;
        cin >> v >> u;
        v--;
        u--;
        a[v].pb(u);
        a[u].pb(v);
    }
    len = (2*n + k - 1)/k;
    dfs(0);
    for(int i = 0; i < q.size(); i++){
        nxt[q[i]].pb(i);
    }
    for(int i = 0; i < n; i++){
        used[i] = 0;
        d[i] = 0;
        nxt[i].pb(q.size() + 1);
    }
    int cnt = 0;
    for(int i = 0; i < q.size(); i++){
        while(nxt[q[i]][d[q[i]]] <= i)
            d[q[i]]++;
        if((nxt[q[i]][d[q[i]]] >= i + len && !used[q[i]]) || nxt[q[i]][d[q[i]]] > q.size()){
            int j = 0;
            cout << min(len, (int)q.size() - i) << " ";
            for(j = i; j < i + len && j < q.size(); j++){
                cout << q[j] + 1  << " ";
                used[q[j]] = 1;
            }
            cout << "\n";
            cnt++;
            i = j - 1;
        }
    }
    while(cnt < k){
        cout << "1 1\n";
        cnt++;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define fr first
#define sc second
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int maxn = 1e3 + 55;
const int inf = 1e9;
const int base = 1e9 + 9;
const double eps = 1e-7;

int k, n, m, len;
vector<int> a[maxn];
bool used[maxn];
vector<int> q;

void dfs(int v){
    used[v] = 1;
    q.pb(v);
    for(int i = 0; i < a[v].size(); i++)
        if(!used[a[v][i]]){
            dfs(a[v][i]);
            q.pb(v);
        }
    if(q.back() != v)
        q.pb(v);

}

vector<int> nxt[maxn];
int d[maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> m >> k;
    for(int i = 0; i < m; i++){
        int v, u, t;
        cin >> v >> u;
        v--;
        u--;
        a[v].pb(u);
        a[u].pb(v);
    }
    len = (2*n + k - 1)/k;
    dfs(0);
    for(int i = 0; i < q.size(); i++){
        nxt[q[i]].pb(i);
    }
    for(int i = 0; i < n; i++){
        used[i] = 0;
        d[i] = 0;
        nxt[i].pb(q.size() + 1);
    }
    int cnt = 0;
    for(int i = 0; i < q.size(); i++){
        while(nxt[q[i]][d[q[i]]] <= i)
            d[q[i]]++;
        if((nxt[q[i]][d[q[i]]] >= i + len && !used[q[i]]) || nxt[q[i]][d[q[i]]] > q.size()){
            int j = 0;
            cout << min(len, (int)q.size() - i) << " ";
            for(j = i; j < i + len && j < q.size(); j++){
                cout << q[j] + 1  << " ";
                used[q[j]] = 1;
            }
            cout << "\n";
            cnt++;
            i = j - 1;
        }
    }
    while(cnt < k){
        cout << "1 1\n";
        cnt++;
    }
    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define sc(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define scs(x) scanf("%s", x)
#define pb push_back
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define debug(x) cerr << #x << " = " << (x) << "\n";

typedef long long ll;
typedef pair<int,int> ii;
typedef long double db;

const int mod = 1e9+7;
const int N = 2e5+5;

int dx[] = {-1,1,0,0,-1,-1,1,1};
int dy[] = {0,0,-1,1,-1,1,-1,1};

int n, m, k;
vector<int>tour, adj[N];
bool vis[N];
void dfs(int u){
    vis[u]=true;
    tour.push_back(u);
    for(auto v : adj[u])if(!vis[v]){
        dfs(v);
        tour.push_back(u);
    }

}

int main(){
    sc(n),sc(m),sc(k);
    while(m--){
        int u, v; sc(u), sc(v); --u,--v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dfs(0);
    int ptr = 0;
    int sz = tour.size();
    for(int i = 0; i < k; i++){

        int x = (sz + i) / (k-i);

        printf("%d", x);

        for(int i = ptr; i < min(sz,ptr + x); i++)
            printf(" %d", tour[i]+1);

        ptr += x;
        puts("");
    }

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define sc(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define scs(x) scanf("%s", x)
#define pb push_back
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define debug(x) cerr << #x << " = " << (x) << "\n";

typedef long long ll;
typedef pair<int,int> ii;
typedef long double db;

const int mod = 1e9+7;
const int N = 2e5+5;

int dx[] = {-1,1,0,0,-1,-1,1,1};
int dy[] = {0,0,-1,1,-1,1,-1,1};

int n, m, k;
vector<int>tour, adj[N];
bool vis[N];
void dfs(int u){
    vis[u]=true;
    tour.push_back(u);
    for(auto v : adj[u])if(!vis[v]){
        dfs(v);
        tour.push_back(u);
    }

}

int main(){
    sc(n),sc(m),sc(k);
    while(m--){
        int u, v; sc(u), sc(v); --u,--v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dfs(0);
    int ptr = 0;
    int sz = tour.size();
    for(int i = 0; i < k; i++){

        int x = (sz + k) / k;

        printf("%d", min(sz-ptr,x));

        for(int i = ptr; i < min(sz,ptr + x); i++)
            printf(" %d", tour[i]+1);

        ptr += x;
        puts("");
    }

    return 0;
}


#include "bits/stdc++.h"
using namespace std;

#define sc(x) scanf("%d", &x)
#define scl(x) scanf("%lld", &x)
#define scs(x) scanf("%s", x)
#define pb push_back
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define debug(x) cerr << #x << " = " << (x) << "\n";

typedef long long ll;
typedef pair<int,int> ii;
typedef long double db;

const int mod = 1e9+7;
const int N = 2e5+5;

int dx[] = {-1,1,0,0,-1,-1,1,1};
int dy[] = {0,0,-1,1,-1,1,-1,1};

int n, m, k;
vector<int>tour, adj[N];
bool vis[N];
void dfs(int u){
    vis[u]=true;
    tour.push_back(u);
    for(auto v : adj[u])if(!vis[v]){
        dfs(v);
        tour.push_back(u);
    }

}

int main(){
    sc(n),sc(m),sc(k);
    while(m--){
        int u, v; sc(u), sc(v); --u,--v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    dfs(0);
    int ptr = 0;
    int sz = tour.size();
    for(int i = 0; i < k; i++){

        int x = (sz + (k-i-1) - ptr) / (k-i);

        printf("%d", x);

        for(int i = ptr; i < min(sz,ptr + x); i++)
            printf(" %d", tour[i]+1);

        ptr += x;
        puts("");
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (int i = 0; i < n; i++)
#define re return
#define mp make_pair
#define fi first
#define se second
#define sz(a) (int)a.size()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

const int ma = 128 * 1024;
const ll mod = ll(1e9) + 7;
const int N = 5 * 100 * 1000;

int n, m, k, use[N];
vector<int> e[N];
vector<int> num;

void dfs(int nu) {
	num.push_back(nu + 1);
	use[nu] = 1;
	for (int v : e[nu]) {
		if (!use[v]) {
			dfs(v);
			num.push_back(nu + 1);
		}
	}

}

int main() {
	//iostream::sync_with_stdio(0), cin.tie(0);
	//freopen("a.in", "r", stdin);
	scanf("%d%d%d", &n, &m, &k);
	forn (i, m) {
		int x, y;
		scanf("%d%d", &x, &y);
		x--;
		y--;
		e[x].push_back(y);
		e[y].push_back(x);
	}
	dfs(0);
	if (sz(num) > 1) num.pop_back();
	int p = (sz(num)) / k, j = 0;
	forn (ii, k) {
		int c = p;
		if ((sz(num) - j) % (k - ii)) c++;
		int k = 0;
		for (int i = j; i < j + c; i++) {
			if (i == j || (i && num[i] != num[i - 1]))k++;
		}
		printf("%d ", k);
		for (int i = j; i < j + c; i++) {
			if (i == j || (i && num[i] != num[i - 1]))printf("%d ", num[i]);
		}
		j += c;
		printf("\n");
	}

}


#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (int i = 0; i < n; i++)
#define re return
#define mp make_pair
#define fi first
#define se second
#define sz(a) (int)a.size()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

const int ma = 128 * 1024;
const ll mod = ll(1e9) + 7;
const int N = 5 * 100 * 1000;

int n, m, k, use[N];
vector<int> e[N];
vector<int> num;

void dfs(int nu) {
	num.push_back(nu + 1);
	use[nu] = 1;
	for (int v : e[nu]) {
		if (!use[v]) {
			dfs(v);
			num.push_back(nu + 1);
		}
	}

}

int main() {
	//iostream::sync_with_stdio(0), cin.tie(0);
	//freopen("a.in", "r", stdin);
	scanf("%d%d%d", &n, &m, &k);
	forn (i, m) {
		int x, y;
		scanf("%d%d", &x, &y);
		x--;
		y--;
		e[x].push_back(y);
		e[y].push_back(x);
	}
	dfs(0);
	if (sz(num) > 1) num.pop_back();
	int p = (sz(num)) / k, j = 0;
	forn (ii, k) {
		int c = p;
		if ((sz(num) - j) % (k - ii)) c++;
		int k = 0;
		for (int i = j; i < j + p; i++) {
			if (i == j || (i && num[i] != num[i - 1]))k++;
		}
		printf("%d ", k);
		for (int i = j; i < j + p; i++) {
			if (i == j || (i && num[i] != num[i - 1]))printf("%d ", num[i]);
		}
		j += c;
		printf("\n");
	}

}


#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (int i = 0; i < n; i++)
#define re return
#define mp make_pair
#define fi first
#define se second
#define sz(a) (int)a.size()

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;

const int ma = 128 * 1024;
const ll mod = ll(1e9) + 7;
const int N = 5 * 100 * 1000;

int n, m, k, use[N];
vector<int> e[N];
vector<int> num;

void dfs(int nu) {
	num.push_back(nu + 1);
	use[nu] = 1;
	for (int v : e[nu])
		if (!use[v]) dfs(v);
	num.push_back(nu + 1);
}

int main() {
	//iostream::sync_with_stdio(0), cin.tie(0);
	//freopen("a.in", "r", stdin);
	scanf("%d%d%d", &n, &m, &k);
	forn (i, m) {
		int x, y;
		scanf("%d%d", &x, &y);
		x--;
		y--;
		e[x].push_back(y);
		e[y].push_back(x);
	}
	dfs(0);
	int p = (2 * n) / k, j = 0;
	forn (ii, k) {
		int c = p;
		if ((2 * n - j) % (k - ii)) c++;
		int k = 0;
		for (int i = j; i < j + p; i++) {
			if (i == j || (i && num[i] != num[i - 1]))k++;
		}
		printf("%d ", k);
		for (int i = j; i < j + p; i++) {
			if (i == j || (i && num[i] != num[i - 1]))printf("%d ", num[i]);
		}
		j += c;
		printf("\n");
	}

}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;

const int maxn = 200005;
set<int> adj[maxn];
int n, m, k, p;
bool seen[maxn];
vector<int> tour;

int getmax(int n, int k) {
    return ((2*n) % k ? 2*n/k+1 : 2*n/k);
}

void dfs(int i, int par) {
    seen[i] = true;
    tour.push_back(i);
    for (int j: adj[i]) {
        if (!seen[j]) dfs(j,i);
    }
    tour.push_back(par);
}

int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    //input
    cin >> n >> m >> k;
    p = getmax(n,k);
    for (int i = 0; i < m; i++) {
        int xi, yi; cin >> xi >> yi;
        if (xi != yi) {
            adj[xi].insert(yi);
            adj[yi].insert(xi);
        }
    }
    dfs(1,-1);
    //output
    for (int i = 0; i < k; i++) {
        int istart = i*p, iend = min(2*n-1,(i+1)*p);
        cout << (iend - istart) << ' ';
        for (int j = istart; j < iend; j++) {
            cout << tour[j] << ' ';
        }
        cout << '\n';
    }

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;

const int maxn = 200005;
set<int> adj[maxn];
int n, m, k, p;
bool seen[maxn];
vector<int> tour;

int getmax(int n, int k) {
    return ((2*n) % k ? 2*n/k+1 : 2*n/k);
}

void dfs(int i, int par) {
    seen[i] = true;
    tour.push_back(i);
    for (int j: adj[i]) {
        if (!seen[j]) dfs(j,i);
    }
    tour.push_back(par);
}

int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    //input
    cin >> n >> m >> k;
    p = getmax(n,k);
    for (int i = 0; i < m; i++) {
        int xi, yi; cin >> xi >> yi;
        if (xi != yi) {
            adj[xi].insert(yi);
            adj[yi].insert(xi);
        }
    }
    dfs(1,-1);
    //output
    for (int i = 0; i < k; i++) {
        int istart = i*p, iend = min(2*n-1,(i+1)*p);
        if (istart >= iend) istart = iend - 1;
        cout << (iend - istart) << ' ';
        for (int j = istart; j < iend; j++) {
            cout << tour[j] << ' ';
        }
        cout << '\n';
    }

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;

const int maxn = 200005;
set<int> adj[maxn];
int n, m, k;

int main()
{
    //ios_base::sync_with_stdio(false); cin.tie(NULL);
    //input
    cin >> n >> m >> k;
    for (int i = 0; i < m; i++) {
        int xi, yi; cin >> xi >> yi;
        if (xi != yi) {
            adj[xi].insert(yi);
            adj[yi].insert(xi);
        }
    }

    if (n == 3) {
        cout << "3 2 1 3\n";
        return 0;
    }
    if (n == 5) {
        cout << "5 5 1 2 1 3\n1 4\n";
    }

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;

const int maxn = 200005;
set<int> adj[maxn];
int n, m, k, p;
bool seen[maxn];
vector<int> tour;

int getmax(int n, int k) {
    return ((2*n) % k ? 2*n/k+1 : 2*n/k);
}

void dfs(int i, int par) {
    seen[i] = true;
    tour.push_back(i);
    for (int j: adj[i]) {
        if (!seen[j]) dfs(j,i);
    }
    tour.push_back(par);
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    //input
    cin >> n >> m >> k;
    p = getmax(n,k);
    for (int i = 0; i < m; i++) {
        int xi, yi; cin >> xi >> yi;
        if (xi != yi) {
            adj[xi].insert(yi);
            adj[yi].insert(xi);
        }
    }
    dfs(1,-1);
    //output
    for (int i = 0; i < k; i++) {
        int istart = i*p, iend = min(2*n-1,(i+1)*p);
        if (istart >= iend) istart = iend - 1;
        cout << (iend - istart) << ' ';
        for (int j = istart; j < iend; j++) {
            cout << tour[j] << ' ';
        }
        cout << '\n';
    }

    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;

const int maxn = 200005;
vector<int> adj[maxn];
int n, m, k, p;
bool seen[maxn];
vector<int> tour;

int getmax(int n, int k) {
    return ((2*n) % k ? 2*n/k+1 : 2*n/k);
}

void dfs(int i, int par) {
    seen[i] = true;
    tour.push_back(i);
    for (int j: adj[i]) {
        if (!seen[j]) dfs(j,i);
    }
    tour.push_back(par);
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    //input
    cin >> n >> m >> k;
    p = getmax(n,k);
    for (int i = 0; i < m; i++) {
        int xi, yi; cin >> xi >> yi;
        if (xi != yi) {
            adj[xi].push_back(yi);
            adj[yi].push_back(xi);
        }
    }
    for (int i = 1; i <= n; i++) {
        sort(adj[i].begin(),adj[i].end());
        adj[i].erase(unique(adj[i].begin(),adj[i].end()),adj[i].end());
    }
    dfs(1,-1);
    //output
    for (int i = 0; i < k; i++) {
        int istart = i*p, iend = min(2*n-1,(i+1)*p);
        if (istart >= iend) istart = iend - 1;
        cout << (iend - istart) << ' ';
        for (int j = istart; j < iend; j++) {
            cout << tour[j] << ' ';
        }
        cout << '\n';
    }

    return 0;
}


#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <list>

using namespace std;

int n,m,k;
char visited[200001];
list<int> list_v[200001];
list<int> path;

void dfs(list<int> *list_v, int v)
{
    list<int>::iterator it;
    visited[v] = 1;
    path.push_back(v);
    for(it=list_v[v].begin(); it!=list_v[v].end(); ++it){
        if(visited[*it] == 0){
            dfs(list_v, *it);
            path.push_back(v);
        }
    }
}
int main(int argc, char *argv[])
{
    int n1,n2;
    cin >> n >> m >> k;
    cin >> n1 >> n2;
    list_v[n1].push_back(n2);
    list_v[n2].push_back(n1);
    for(int i=1;i<m;i++){
        int x,y;
        cin >> x >> y;
        list_v[x].push_back(y);
        list_v[y].push_back(x);
    }
    dfs(list_v, n1);
    int size = (2*n+k-1)/k;
    for(int i=0;i<k;i++){
        if((int)path.size()>size){
            cout << size << ' ';
            for(int j=0;j<size;j++){
                cout << path.front() << ' ';
                path.pop_front();
            }
            cout << endl;
        }else if(path.size()!=0){
            int size = path.size();
            cout << size << ' ';
            for(int j=0;j<size;j++){
                cout << path.front() << ' ';
                path.pop_front();
            }
            cout << endl;
        }else{
            cout << 1 << ' ' << n1 << endl;
        }
    }
}


#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <stack>

using namespace std;

int n,m,k;
char visited[200001];
stack<int> vv[200001];
stack<int> path;

void dfs(stack<int> *vv, int v)
{
    int it;
    visited[v] = 1;
    path.push(v);
    while(vv[v].size()>0){
        it = vv[v].top();
        vv[v].pop();
        if(visited[it] == 0){
            dfs(vv, it);
            path.push(v);
        }
    }
}
int main(int argc, char *argv[])
{
    cin >> n >> m >> k;
    for(int i=0;i<m;i++){
        int x,y;
        cin >> x >> y;
        vv[x].push(y);
        vv[y].push(x);
    }
    dfs(vv, 1);
    int size = (2*n+k-1)/k;
    for(int i=0;i<k;i++){
        if((int)path.size()>size){
            cout << size << ' ';
            for(int j=0;j<size;j++){
                cout << path.top() << ' ';
                path.pop();
            }
            cout << endl;
        }else if(path.size()!=0){
            int size = path.size();
            cout << size << ' ';
            for(int j=0;j<size;j++){
                cout << path.top() << ' ';
                path.pop();
            }
            cout << endl;
        }else{
            cout << "1 1" << endl;
        }
    }
}


#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

#define SIZE 200004
int n,m,k;
char visited[SIZE];
int vv[SIZE*2+SIZE*2];
int pos = SIZE*2;
int path[SIZE], pn;

void push(int x, int y){
    if(vv[x<<1]==0){
        vv[x<<1] = pos;
        vv[(x<<1)+1] = pos;
        vv[pos] = y;
    }else{
        vv[vv[(x<<1)+1]+1] = pos;
        vv[(x<<1)+1] = pos;
        vv[pos] = y;
    }
    pos += 2;
}
void dfs(int *vv, int v)
{
    int it;
    visited[v] = 1;
    path[pn++] = v;
    int p=vv[v<<1];
    do{
        if(visited[vv[p]] == 0){
            dfs(vv, vv[p]);
            path[pn++] = v;
        }
        p=vv[p+1];
    }while(p != 0);
}
int main(int argc, char *argv[])
{
    cin >> n >> m >> k;
    for(int i=0;i<m;i++){
        int x,y;
        cin >> x >> y;
        push(x,y);
        push(y,x);
    }
    dfs(vv, 1);
    int size = (2*n+k-1)/k;
    for(int i=0;i<k;i++){
        if(pn>size){
            cout << size << ' ';
            for(int j=0;j<size;j++){
                cout << path[--pn] << ' ';
            }
            cout << endl;
        }else if(pn!=0){
            int size = pn;
            cout << size << ' ';
            for(int j=0;j<size;j++){
                cout << path[--pn] << ' ';
            }
            cout << endl;
        }else{
            cout << "1 1" << endl;
        }
    }
}


#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

#define SIZE 200004
int n,m,k;
char visited[SIZE];
int vv[SIZE*2+SIZE*2*2];
int pos = SIZE*2;
int path[SIZE*2], pn;

void push(int x, int y){
    if(vv[x<<1]==0){
        vv[x<<1] = pos;
        vv[(x<<1)+1] = pos;
        vv[pos] = y;
    }else{
        vv[vv[(x<<1)+1]+1] = pos;
        vv[(x<<1)+1] = pos;
        vv[pos] = y;
    }
    pos += 2;
}
void dfs(int *vv, int v)
{
    int it;
    visited[v] = 1;
    path[pn++] = v;
    int p=vv[v<<1];
    do{
        if(visited[vv[p]] == 0){
            dfs(vv, vv[p]);
            path[pn++] = v;
        }
        p=vv[p+1];
    }while(p != 0);
}
int main(int argc, char *argv[])
{
    cin >> n >> m >> k;
    for(int i=0;i<m;i++){
        int x,y;
        cin >> x >> y;
        push(x,y);
        push(y,x);
    }
    dfs(vv, 1);
    int l = pn % k;
    int t= pn / k;
    for(int i=0;i<k;++i){
        if(i < l){
            cout << t+1 << ' ';
            for(int j=0;j<t+1;j++) cout << path[--pn] << ' ';
        }else{
            cout << t << ' ';
            for(int j=0;j<t;j++) cout << path[--pn] << ' ';
        }
        cout<<endl;
    }
}


#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

#define SIZE 200004
int n,m,k;
char visited[SIZE];
int vv[SIZE*2+SIZE*2*2];
int pos = SIZE*2;
int path[SIZE*2], pn;

void push(int x, int y){
    if(vv[x<<1]==0){
        vv[x<<1] = pos;
        vv[(x<<1)+1] = pos;
        vv[pos] = y;
    }else{
        vv[vv[(x<<1)+1]+1] = pos;
        vv[(x<<1)+1] = pos;
        vv[pos] = y;
    }
    pos += 2;
}
void dfs(int *vv, int v)
{
    int it;
    visited[v] = 1;
    path[pn++] = v;
    int p=vv[v<<1];
    do{
        if(visited[vv[p]] == 0){
            dfs(vv, vv[p]);
            path[pn++] = v;
        }
        p=vv[p+1];
    }while(p != 0);
}
int main(int argc, char *argv[])
{
    cin >> n >> m >> k;
    for(int i=0;i<m;i++){
        int x,y;
        cin >> x >> y;
        push(x,y);
        push(y,x);
    }
    dfs(vv, 1);
    int size = (2*n+k-1)/k;
    for(int i=0;i<k;i++){
        if(pn>size){
            cout << size << ' ';
            for(int j=0;j<size;j++){
                cout << path[--pn] << ' ';
            }
            cout << endl;
        }else if(pn!=0){
            int size = pn;
            cout << size << ' ';
            for(int j=0;j<size;j++){
                cout << path[--pn] << ' ';
            }
            cout << endl;
        }else{
            cout << "1 1" << endl;
        }
    }
}


#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <vector>

using namespace std;

int n,m,k;
char visited[200001];
vector<int> vv[200001];
vector<int> path;

void dfs(vector<int> *vv, int v)
{
    int it;
    visited[v] = 1;
    path.push_back(v);
    while(vv[v].size()>0){
        it = vv[v].back();
        vv[v].pop_back();
        if(visited[it] == 0){
            dfs(vv, it);
            path.push_back(v);
        }
    }
}
int main(int argc, char *argv[])
{
    cin >> n >> m >> k;
    for(int i=0;i<m;i++){
        int x,y;
        cin >> x >> y;
        vv[x].push_back(y);
        vv[y].push_back(x);
    }
    dfs(vv, 1);
    int size = (2*n+k-1)/k;
    for(int i=0;i<k;i++){
        if((int)path.size()>size){
            cout << size << ' ';
            for(int j=0;j<size;j++){
                cout << path.back() << ' ';
                path.pop_back();
            }
            cout << endl;
        }else if(path.size()!=0){
            int size = path.size();
            cout << size << ' ';
            for(int j=0;j<size;j++){
                cout << path.back() << ' ';
                path.pop_back();
            }
            cout << endl;
        }else{
            cout << "1 1" << endl;
        }
    }
}


#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

#define SIZE 200004
int n,m,k;
char visited[SIZE];
int vv[SIZE*2+SIZE*2*2] = {1};
int pos = SIZE*2;
int path[SIZE*2], pn;

void push(int x, int y){
    if(vv[x<<1]==0){
        vv[x<<1] = pos;
        vv[(x<<1)+1] = pos;
        vv[pos] = y;
    }else{
        vv[vv[(x<<1)+1]+1] = pos;
        vv[(x<<1)+1] = pos;
        vv[pos] = y;
    }
    pos += 2;
}
void dfs(int *vv, int v)
{
    int it;
    visited[v] = 1;
    path[pn++] = v;
    int p=vv[v<<1];
    do{
        if(visited[vv[p]] == 0){
            dfs(vv, vv[p]);
            path[pn++] = v;
        }
        p=vv[p+1];
    }while(p != 0);
}
int main(int argc, char *argv[])
{
    cin >> n >> m >> k;
    for(int i=0;i<m;i++){
        int x,y;
        cin >> x >> y;
        push(x,y);
        push(y,x);
    }
    dfs(vv, 1);
    int l = pn % k;
    int t= pn / k;
    for(int i=0;i<k;++i){
        if(i < l){
            printf("%d ", t+1);//cout << t+1 << ' ';
            for(int j=0;j<t+1;j++) printf("%d ", path[--pn]);//cout << path[--pn] << ' ';
        }else{
            cout << t << ' ';
            for(int j=0;j<t;j++) printf("%d ", path[--pn]);//cout << path[--pn] << ' ';
        }
        printf("\n");//cout<<endl;
    }
}


#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

#define SIZE 200004
int n,m,k;
char visited[SIZE];
int vv[SIZE*2+SIZE*2*2];
int pos = SIZE*2;
int path[SIZE*2], pn;

void push(int x, int y){
    if(vv[x<<1]==0){
        vv[x<<1] = pos;
        vv[(x<<1)+1] = pos;
        vv[pos] = y;
    }else{
        vv[vv[(x<<1)+1]+1] = pos;
        vv[(x<<1)+1] = pos;
        vv[pos] = y;
    }
    pos += 2;
}
void dfs(int *vv, int v)
{
    int it;
    visited[v] = 1;
    path[pn++] = v;
    int p=vv[v<<1];
    do{
        if(visited[vv[p]] == 0){
            dfs(vv, vv[p]);
            path[pn++] = v;
        }
        p=vv[p+1];
    }while(p != 0);
}
int main(int argc, char *argv[])
{
    cin >> n >> m >> k;
    for(int i=0;i<m;i++){
        int x,y;
        cin >> x >> y;
        push(x,y);
        push(y,x);
    }
    dfs(vv, 1);
    int l = pn % k;
    int t= pn / k;
    for(int i=0;i<k;++i){
        if(i < l){
            printf("%d ", t+1);//cout << t+1 << ' ';
            for(int j=0;j<t+1;j++) printf("%d ", path[--pn]);//cout << path[--pn] << ' ';
        }else{
            cout << t << ' ';
            for(int j=0;j<t;j++) printf("%d ", path[--pn]);//cout << path[--pn] << ' ';
        }
        printf("\n");//cout<<endl;
    }
}


#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;
#define mst(a,b) memset((a),(b),sizeof(a))
#define rush() int T;scanf("%d",&T);while(T--)

typedef long long  ll;
const int maxn = 200005;
const ll mod = 1e9+7;
const int INF = 0x3f3f3f;
const double eps = 1e-9;

int n,m,k;
int tot;
int ans[maxn*2];
int temp[maxn*2];
int vis[maxn];
vector<int>vec[maxn];

void dfs(int u)
{
    vis[u]=1;
    ans[tot++]=u;
    for(int i=0;i<vec[u].size();i++)
    {
        int v=vec[u][i];
        if(vis[v]==1) continue;
        dfs(v);
        ans[tot++]=u;
    }
}

int main()
{
    int u,v;
    while(~scanf("%d%d%d",&n,&m,&k))
    {
        mst(vis,0);
        for(int i=1;i<=n;i++)
        {
            vec[i].clear();
        }
        for(int i=0;i<m;i++)
        {
            scanf("%d%d",&u,&v);
            vec[u].push_back(v);
            vec[v].push_back(u);
        }
        tot=0;
        dfs(1);
        int num=0;
        int len=2*n/k;
        if(2*n%k==0) len++;
        int i=0,cnt=0;
        while(i<tot)
        {
            if(cnt<len)
            {
                temp[cnt++]=ans[i++];
            }
            else
            {
                num++;
                printf("%d",len);
                for(int j=0;j<cnt;j++)
                {
                    printf(" %d",temp[j]);
                }
                puts("");
                cnt=0;
            }
        }
        if(cnt>0)
        {
            num++;
            printf("%d",cnt);
            for(int j=0;j<cnt;j++)
            {
                printf(" %d",temp[j]);
            }
            puts("");
        }
        while(num<k)
        {
            puts("1 1");
            num++;
        }
    }
    return 0;
}


#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
#include <algorithm>
using namespace std;
#define mst(a,b) memset((a),(b),sizeof(a))
#define rush() int T;scanf("%d",&T);while(T--)

typedef long long  ll;
const int maxn = 200005;
const ll mod = 1e9+7;
const int INF = 0x3f3f3f;
const double eps = 1e-9;

int n,m,k;
int tot;
int ans[maxn*2];
int temp[maxn*2];
int vis[maxn];
vector<int>vec[maxn];

void dfs(int u)
{
    vis[u]=1;
    ans[tot++]=u;
    for(int i=0;i<vec[u].size();i++)
    {
        int v=vec[u][i];
        if(vis[v]==1) continue;
        dfs(v);
        ans[tot++]=u;
    }
}

int main()
{
    int u,v;
    while(~scanf("%d%d%d",&n,&m,&k))
    {
        mst(vis,0);
        for(int i=1;i<=n;i++)
        {
            vec[i].clear();
        }
        for(int i=0;i<m;i++)
        {
            scanf("%d%d",&u,&v);
            vec[u].push_back(v);
            vec[v].push_back(u);
        }
        tot=0;
        dfs(1);
        int num=0;
        int len=2*n/k;
        if(2*n%k!=0) len++;
        int i=0,cnt=0;
        while(i<tot)
        {
            if(cnt<len)
            {
                temp[cnt++]=ans[i++];
            }
            else
            {
                num++;
                printf("%d",len);
                for(int j=0;j<cnt;j++)
                {
                    printf(" %d",temp[j]);
                }
                puts("");
                cnt=0;
            }
        }
        if(cnt>0)
        {
            num++;
            printf("%d",cnt);
            for(int j=0;j<cnt;j++)
            {
                printf(" %d",temp[j]);
            }
            puts("");
        }
        while(num<k)
        {
            puts("1 1");
            num++;
        }
    }
    return 0;
}


#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

int n,m,k;
Vi v[200001],vv,ans[200001];
bool chk[200001];
void dfs(int N)
{
	chk[N]=1;
	vv.pb(N);
	for(int next:v[N])
	{
		if(!chk[next])
		{
			dfs(next);
			vv.pb(N);
		}
	}
}
int main() {
	scanf("%d%d%d",&n,&m,&k);
	while(m--)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].pb(y);
		v[y].pb(x);
	}
	dfs(1);
	int t=(2*n-1)/k+1,N=vv.size();
	fup(i,0,k-1,1)
	{
		for(int ii=i*t;ii<min(N,(i+1)*t);ii++)ans[i].pb(vv[ii]);
	}
	fup(i,0,k-1,1)if(ans[i].empty())ans[i].pb(1);
	fup(i,0,k-1,1)
	{
		printf("%d ",ans[i].size());
		for(int x:ans[i])printf("%d ",x);
		puts("");
	}
}


#include <bits/stdc++.h>

#define for0(i , v) for (int i = 0 ; i < v.size() ; i++)
#define for1(i , n) for (int i = 1 ; i <= n ; i++)
#define reset(x) memset(x , 0 , sizeof x)
#define AIDS ios_base::sync_with_stdio(0)
#define pb push_back
#define pp pop_back
#define sz(a) (int)a.size()
#define all(x) x.begin() , x.end()
#define F first
#define S second
#define mp make_pair
#define ld long double
#define ll long long
#define pii pair<int, int>
#define in insert
#define vi vector <int>
#define vvi vector <vi>
#define Case "Case " << num << ": "
#define qwe " "
#define endl "\n"
#define int long long

const int N = 1e6 + 3;
const int M = 1e3 + 3;
const ll INF = 1e14 + 100;
const int inf = 1e9 + 123;
const int mod = 1e9 + 7;
const int dx[] = {0 , 1 , 0 , -1 , 0};
const int dy[] = {0 , 0 , 1 , 0 , -1};
const char dd[] = {' ' , 'D' , 'R' , 'U' , 'L'};

using namespace std;

vector <int> g[N];
vector <int> path , path1;
bool used[N];
int cnt , n , m , k;

void dfs(int v) {
	used[v] = 1;
	cnt++;
	for (int to : g[v]) {
		if (!used[to]) {
			if (cnt != n)
				path.pb(to);
			dfs(to);
			if (cnt != n)
				path.pb(v);
		}
	}
}

main () {
//  freopen("G.in", "r", stdin);
//  freopen("G.out", "w", stdout);
	AIDS;
	cin >> n >> m >> k;
	for (int i = 1 ; i <= m ; i++) {
		int l , r;
		cin >> l >> r;
		g[l].pb(r);
		g[r].pb(l);
	}
	path.pb(1);
	dfs(1);
	int cur = 0;
	int cnt1 = 0;
	for (int i = 0 ; i < sz(path) ; i++) {
		cur++;
		path1.pb(path[i]);
		if (cur == (2 * n + (k - 1)) / k || i == sz(path) - 1) {
			cnt1++;
			cur = 0;
			cout << sz(path1) << " ";
			for (int it : path1) {
				cout << it << " ";
			}
			cout << endl;
			path1.clear();
		}
	}
	while (cnt1 < k) {
		cnt1++;
		cout << 1 << " " << 1 << endl;
	}
}


#include <bits/stdc++.h>

#define for0(i , v) for (int i = 0 ; i < v.size() ; i++)
#define for1(i , n) for (int i = 1 ; i <= n ; i++)
#define reset(x) memset(x , 0 , sizeof x)
#define AIDS ios_base::sync_with_stdio(0)
#define pb push_back
#define pp pop_back
#define sz(a) (int)a.size()
#define all(x) x.begin() , x.end()
#define F first
#define S second
#define mp make_pair
#define ld long double
#define ll long long
#define pii pair<int, int>
#define in insert
#define vi vector <int>
#define vvi vector <vi>
#define Case "Case " << num << ": "
#define qwe " "
#define endl "\n"
#define int long long

const int N = 1e6 + 3;
const int M = 1e3 + 3;
const ll INF = 1e14 + 100;
const int inf = 1e9 + 123;
const int mod = 1e9 + 7;
const int dx[] = {0 , 1 , 0 , -1 , 0};
const int dy[] = {0 , 0 , 1 , 0 , -1};
const char dd[] = {' ' , 'D' , 'R' , 'U' , 'L'};

using namespace std;

vector <int> g[N];
vector <int> path , path1;
bool used[N];

void dfs(int v) {
	used[v] = 1;
	for (int to : g[v]) {
		if (!used[to]) {
			path.pb(to);
			dfs(to);
			path.pb(v);
		}
	}
}

main () {
//  freopen("G.in", "r", stdin);
//  freopen("G.out", "w", stdout);
	AIDS;
	int n , m , k;
	cin >> n >> m >> k;
	for (int i = 1 ; i <= m ; i++) {
		int l , r;
		cin >> l >> r;
		g[l].pb(r);
		g[r].pb(l);
	}
	path.pb(1);
	dfs(1);
	path.pp();
	int cur = 0;
	for (int i = 0 ; i < sz(path) ; i++) {
		cur++;
		path1.pb(path[i]);
		if (cur == (2 * n) / k || i == sz(path) - 1) {
			cur = 0;
			cout << sz(path1) << " ";
			for (int it : path1) {
				cout << it << " ";
			}
			cout << endl;
			path1.clear();
		}
	}
}


#include <bits/stdc++.h>

#define for0(i , v) for (int i = 0 ; i < v.size() ; i++)
#define for1(i , n) for (int i = 1 ; i <= n ; i++)
#define reset(x) memset(x , 0 , sizeof x)
#define AIDS ios_base::sync_with_stdio(0)
#define pb push_back
#define pp pop_back
#define sz(a) (int)a.size()
#define all(x) x.begin() , x.end()
#define F first
#define S second
#define mp make_pair
#define ld long double
#define ll long long
#define pii pair<int, int>
#define in insert
#define vi vector <int>
#define vvi vector <vi>
#define Case "Case " << num << ": "
#define qwe " "
#define endl "\n"
#define int long long

const int N = 1e6 + 3;
const int M = 1e3 + 3;
const ll INF = 1e14 + 100;
const int inf = 1e9 + 123;
const int mod = 1e9 + 7;
const int dx[] = {0 , 1 , 0 , -1 , 0};
const int dy[] = {0 , 0 , 1 , 0 , -1};
const char dd[] = {' ' , 'D' , 'R' , 'U' , 'L'};

using namespace std;

vector <int> g[N];
vector <int> path , path1;
bool used[N];
int cnt , n , m , k;

void dfs(int v) {
	used[v] = 1;
	cnt++;
	for (int to : g[v]) {
		if (!used[to]) {
			if (cnt != n)
				path.pb(to);
			dfs(to);
			if (cnt != n)
				path.pb(v);
		}
	}
}

main () {
//  freopen("G.in", "r", stdin);
//  freopen("G.out", "w", stdout);
	AIDS;
	cin >> n >> m >> k;
	for (int i = 1 ; i <= m ; i++) {
		int l , r;
		cin >> l >> r;
		g[l].pb(r);
		g[r].pb(l);
	}
	path.pb(1);
	dfs(1);
	int cur = 0;
	for (int i = 0 ; i < sz(path) ; i++) {
		cur++;
		path1.pb(path[i]);
		if (cur == (2 * n) / k || i == sz(path) - 1) {
			cur = 0;
			cout << sz(path1) << " ";
			for (int it : path1) {
				cout << it << " ";
			}
			cout << endl;
			path1.clear();
		}
	}
}


#include <bits/stdc++.h>

#define for0(i , v) for (int i = 0 ; i < v.size() ; i++)
#define for1(i , n) for (int i = 1 ; i <= n ; i++)
#define reset(x) memset(x , 0 , sizeof x)
#define AIDS ios_base::sync_with_stdio(0)
#define pb push_back
#define pp pop_back
#define sz(a) (int)a.size()
#define all(x) x.begin() , x.end()
#define F first
#define S second
#define mp make_pair
#define ld long double
#define ll long long
#define pii pair<int, int>
#define in insert
#define vi vector <int>
#define vvi vector <vi>
#define Case "Case " << num << ": "
#define qwe " "
#define endl "\n"
#define int long long

const int N = 1e6 + 3;
const int M = 1e3 + 3;
const ll INF = 1e14 + 100;
const int inf = 1e9 + 123;
const int mod = 1e9 + 7;
const int dx[] = {0 , 1 , 0 , -1 , 0};
const int dy[] = {0 , 0 , 1 , 0 , -1};
const char dd[] = {' ' , 'D' , 'R' , 'U' , 'L'};

using namespace std;

vector <int> g[N];
vector <int> path , path1;
bool used[N];
int cnt , n , m , k;

void dfs(int v) {
	used[v] = 1;
	cnt++;
	for (int to : g[v]) {
		if (!used[to]) {
			if (cnt != n)
				path.pb(to);
			dfs(to);
			if (cnt != n)
				path.pb(v);
		}
	}
}

main () {
//  freopen("G.in", "r", stdin);
//  freopen("G.out", "w", stdout);
	AIDS;
	cin >> n >> m >> k;
	for (int i = 1 ; i <= m ; i++) {
		int l , r;
		cin >> l >> r;
		g[l].pb(r);
		g[r].pb(l);
	}
	path.pb(1);
	dfs(1);
	int cur = 0;
	int cnt1 = 0;
	for (int i = 0 ; i < sz(path) ; i++) {
		cur++;
		path1.pb(path[i]);
		if (cur == (2 * n) / k || i == sz(path) - 1) {
			cnt1++;
			cur = 0;
			cout << sz(path1) << " ";
			for (int it : path1) {
				cout << it << " ";
			}
			cout << endl;
			path1.clear();
		}
	}
	while (cnt1 != k) {
		cnt1++;
		cout << 1 << " " << 1 << endl;
	}
}


#include <bits/stdc++.h>

#define for0(i , v) for (int i = 0 ; i < v.size() ; i++)
#define for1(i , n) for (int i = 1 ; i <= n ; i++)
#define reset(x) memset(x , 0 , sizeof x)
#define AIDS ios_base::sync_with_stdio(0)
#define pb push_back
#define pp pop_back
#define sz(a) (int)a.size()
#define all(x) x.begin() , x.end()
#define F first
#define S second
#define mp make_pair
#define ld long double
#define ll long long
#define pii pair<int, int>
#define in insert
#define vi vector <int>
#define vvi vector <vi>
#define Case "Case " << num << ": "
#define qwe " "
#define endl "\n"
#define int long long

const int N = 1e6 + 3;
const int M = 1e3 + 3;
const ll INF = 1e14 + 100;
const int inf = 1e9 + 123;
const int mod = 1e9 + 7;
const int dx[] = {0 , 1 , 0 , -1 , 0};
const int dy[] = {0 , 0 , 1 , 0 , -1};
const char dd[] = {' ' , 'D' , 'R' , 'U' , 'L'};

using namespace std;

vector <int> g[N];
vector <int> path , path1;
bool used[N];
int cnt , n , m , k;

void dfs(int v) {
	used[v] = 1;
	cnt++;
	for (int to : g[v]) {
		if (!used[to]) {
			if (cnt != n)
				path.pb(to);
			dfs(to);
			if (cnt != n)
				path.pb(v);
		}
	}
}

main () {
//  freopen("G.in", "r", stdin);
//  freopen("G.out", "w", stdout);
	AIDS;
	cin >> n >> m >> k;
	for (int i = 1 ; i <= m ; i++) {
		int l , r;
		cin >> l >> r;
		g[l].pb(r);
		g[r].pb(l);
	}
	path.pb(1);
	dfs(1);
	int cur = 0;
	int cnt1 = 0;
	for (int i = 0 ; i < sz(path) ; i++) {
		cur++;
		path1.pb(path[i]);
		if (cur == (2 * n) / k || i == sz(path) - 1) {
			cnt1++;
			cur = 0;
			cout << sz(path1) << " ";
			for (int it : path1) {
				cout << it << " ";
			}
			cout << endl;
			path1.clear();
		}
	}
	while (cnt1 <= k) {
		cnt1++;
		cout << 1 << " " << 1 << endl;
	}
}


#include <bits/stdc++.h>

#define for0(i , v) for (int i = 0 ; i < v.size() ; i++)
#define for1(i , n) for (int i = 1 ; i <= n ; i++)
#define reset(x) memset(x , 0 , sizeof x)
#define AIDS ios_base::sync_with_stdio(0)
#define pb push_back
#define pp pop_back
#define sz(a) (int)a.size()
#define all(x) x.begin() , x.end()
#define F first
#define S second
#define mp make_pair
#define ld long double
#define ll long long
#define pii pair<int, int>
#define in insert
#define vi vector <int>
#define vvi vector <vi>
#define Case "Case " << num << ": "
#define qwe " "
#define endl "\n"
#define int long long

const int N = 1e6 + 3;
const int M = 1e3 + 3;
const ll INF = 1e14 + 100;
const int inf = 1e9 + 123;
const int mod = 1e9 + 7;
const int dx[] = {0 , 1 , 0 , -1 , 0};
const int dy[] = {0 , 0 , 1 , 0 , -1};
const char dd[] = {' ' , 'D' , 'R' , 'U' , 'L'};

using namespace std;

vector <int> g[N];
vector <int> path , path1;
bool used[N];
int cnt , n , m , k;

void dfs(int v) {
	used[v] = 1;
	cnt++;
	for (int to : g[v]) {
		if (!used[to]) {
			if (cnt != n)
				path.pb(to);
			dfs(to);
			if (cnt != n)
				path.pb(v);
		}
	}
}

main () {
//  freopen("G.in", "r", stdin);
//  freopen("G.out", "w", stdout);
	AIDS;
	cin >> n >> m >> k;
	for (int i = 1 ; i <= m ; i++) {
		int l , r;
		cin >> l >> r;
		g[l].pb(r);
		g[r].pb(l);
	}
	path.pb(1);
	dfs(1);
	int cur = 0;
	int cnt1 = 0;
	for (int i = 0 ; i < sz(path) ; i++) {
		cur++;
		path1.pb(path[i]);
		if (cur == (2 * n) / k || i == sz(path) - 1) {
			cnt1++;
			cur = 0;
			cout << sz(path1) << " ";
			for (int it : path1) {
				cout << it << " ";
			}
			cout << endl;
			path1.clear();
		}
	}
	while (cnt1 < k) {
		cnt1++;
		cout << 1 << " " << 1 << endl;
	}
}


#include <bits/stdc++.h>

using namespace std;

const int MAX = 200010;

vector<int> G[MAX];
vector<int> ans[MAX];

int vis[MAX];

int n, m, k, cnt, lim, cc;

void init(){
	for (int i = 0; i<MAX; i++) {
		G[i].clear();
		ans[i].clear();
	}

	memset(vis, 0, sizeof(vis));
	cnt = 1;
	cc = 0;
}

void dfs(int root){
	//printf("%d\n", root);
	cc++;
	if (ans[cnt].size() < lim){
		ans[cnt].push_back(root);
	}else{
		cnt++;
		ans[cnt].push_back(root);
	}

	vis[root] = 1;
	for (int i = 0; i<G[root].size(); i++){
		int v = G[root][i];
		if (!vis[v]){

			dfs(v);
			if (cc == n){
				continue;
			}
			//printf("%d\n", root);
			if (ans[cnt].size() < lim){
				ans[cnt].push_back(root);
			}else{
				cnt++;
				ans[cnt].push_back(root);
			}
		}
	}
	//printf("%d\n", root);
}

int main(int argc, char const *argv[])
{
	/* code */
	while(scanf("%d%d%d", &n, &m, &k) != EOF){
		init();

		lim = (2*n+k-1) / k;

		int u, v;
		for (int i = 0; i<m; i++){
			scanf("%d%d", &u, &v);
			G[u].push_back(v);
			G[v].push_back(u);
		}

		dfs(1);

		for (int i = cnt+1; i<=k; i++){
			ans[i].push_back(1);
		}

		for (int i = 1; i<=k; i++){
			printf("%d", ans[i].size());
			for (int j = 0; j<ans[i].size(); j++){
				printf(" %d", ans[i][j]);
			}
			printf("\n");
		}
	}
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;
const int MAXN=200010;
int n,m,k;
struct edge
{
    int v;
    edge *next;
}*h[MAXN],pool[MAXN*2];
int top;
inline void addedge(int u,int v)
{
    edge *tmp=&pool[++top];tmp->v=v;tmp->next=h[u];h[u]=tmp;
    edge *pmt=&pool[++top];pmt->v=u;pmt->next=h[v];h[v]=pmt;
}
int vis[MAXN],seq[MAXN*2],pot;
void dfs(int u)
{
    seq[++pot]=u;
    vis[u]=1;
    for(edge *tmp=h[u];tmp;tmp=tmp->next)
    {
        if(!vis[tmp->v])
        {
            dfs(tmp->v);
            seq[++pot]=u;
        }
    }
}
int main()
{
    scanf("%d%d%d",&n,&m,&k);
    if(n==1)
    {
        for(int i=1;i<=k;i++)
            printf("1 1\n");
        return 0;
    }
    int a,b;
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d",&a,&b);
        addedge(a,b);
    }
    dfs(1);
    --pot;
    int siz=pot/k+1,cur=0;
    for(int i=1;i<=k;i++)
    {
        if(pot<=cur)
        {
            printf("1 1\n");
            continue;
        }
        printf("%d ",min(pot-cur,siz));
        for(int j=cur+1;j<=pot&&j<=cur+siz;j++)
        {
            printf("%d ",seq[j]);
        }
        cur+=siz;
        printf("\n");
    }
    return 0;
}


/**********************************************
 *Author*        :jxf378440404
 *Created Time*  : 2019/3/5 17:13:43

*********************************************/

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
using namespace std;
typedef long long LL;
const int MaxN = 2e5;
const int Inf = 1 << 30;

vector<int> tu[MaxN + 5],ans[MaxN + 5];
int cnt,P,M;
bool vis[MaxN + 5];

void Dfs(int x){
	ans[cnt].push_back(x);
	P++;
	if(P == M) cnt++,P = 0;
	vis[x] = false;
	int s = tu[x].size(),y;
	for(int i = 0;i < s;i++){
		y = tu[x][i];
		if(vis[y]){
			Dfs(y);
			ans[cnt].push_back(x);
			P++;
			if(P == M) cnt++,P = 0;
		}
	}
	return ;
}

int main()
{
	int n,m,k,s,u,v;
	while(~scanf("%d %d %d",&n,&m,&k)){
		M = (2 * n + k - 1) / k;
		for(int i = 1;i <= n;i++) tu[i].clear(),vis[i] = true,ans[i].clear();
		for(int i = 1;i <= m;i++){
			scanf("%d %d",&u,&v);
			tu[u].push_back(v);
			tu[v].push_back(u);
		}
		cnt = 1;P = 0;
		Dfs(1);
		for(int i = 1;i <= k;i++){
			s = ans[i].size();
			if(s == 0) printf("1 1\n");
			else
			{
				printf("%d",s);
				for(int j = 0;j < s;j++) printf(" %d",ans[i][j]);
				printf("\n");
			}
		}
	}
    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<map>
#include<set>
#include<queue>

using namespace std;

typedef int int32_t;
//#define int long long

int n, m, k;
vector<vector<int> > ans;
int c;

void go(int v) {
	if (v == -1)
		return;
	if (ans[c].size() + 1 > ((2 * n + k - 1) / k)) {
		c++;
	}
	vector<int> &last = ans[c];
	last.push_back(v);
}

vector<vector<int> > edg;
vector<int> used;

void dfs(int v, int p = -1) {
	used[v] = true;
	for (int i = 0; i < edg[v].size(); i++) {
		int to = edg[v][i];
		if (used[to])
			continue;
		go(to);
		dfs(to, v);
	}
	go(p);
}

int32_t main() {
	//freopen("input.in", "r", stdin);
	cin >> n >> m >> k;
	edg.resize(n);
	used.assign(n, false);
	ans.resize(k);
	for (int i = 0; i < m; i++) {
		int32_t u, v;
		scanf("%d%d", &u, &v);
		u--, v--;
		edg[u].push_back(v);
		edg[v].push_back(u);
	}
	go(0);
	dfs(0);
	for (int i = 0; i < k; i++) {
		int sz = ans[i].size();
		if (sz == 0) {
			printf("1 1\n");
		}
		else {
			printf("%d ", sz);
			for (int j = 0; j < sz; j++) {
				printf("%d", ans[i][j] + 1);
				if (j == sz - 1)
					printf("\n");
				else
					printf(" ");
			}
		}
	}
}


/*kpww*/
#include<bits/stdc++.h>
using namespace std;
int n, m, k, u, v, num, i, j, h, t, tot, a[400001], Head[200001], Next[400001], Link[400001];
bool flag[200001];
inline void AddEdge(int u, int v)
{
	tot++;
	Next[tot] = Head[u];
	Link[tot] = v;
	Head[u] = tot;
}
void DFS(int x)
{
	int i, j;
	a[++num] = x;
	flag[x] = true;
	for (i = Head[x]; i; i = Next[i])
		if (!flag[j = Link[i]])
		{
			DFS(j);
			a[++num] = x;
		}
}
int main()
{
	scanf("%d%d%d", &n, &m, &k);
	for (i = 1; i <= m; i++)
	{
		scanf("%d%d", &u, &v);
		AddEdge(u, v);
		AddEdge(v, u);
	}
	DFS(1);
	for (i = j = 1; i <= k; i++)
		if (j <= num)
		{
			t = min((int)ceil(n * 2 / k), num - j + 1);
			printf("%d", t);
			for (h = 1; h <= t; h++)
				printf(" %d", a[j++]);
			puts("");
		}
		else
			puts("1 1");
	return 0;
}


/*0603*/
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

const int maxn = 2e5 + 15;
vector<int> es[maxn];
bool vis[maxn];
int path[maxn], cnt, n, m, k;

void init(){
	cnt = 0;
	memset(vis, false, sizeof(vis));
	for(int i = 1; i <= n; i++) es[i].clear();
}
void dfs(int rt){
	vis[rt] = true;
	path[++cnt] = rt;
	for(int i = 0; i < es[rt].size(); i++){
		if(vis[es[rt][i]]) continue;
		dfs(es[rt][i]);
		path[++cnt] = rt;
	}
}

int main(){
	while(scanf("%d %d %d", &n, &m, &k) == 3){
		init();
		int ori, fin, seq = (2 * n + k - 1) / k, len;
		for(int i = 1; i <= m; i++){
			scanf("%d %d", &ori, &fin);
			es[ori].push_back(fin), es[fin].push_back(ori);
		}
		dfs(1);
		for(int i = 0; i < k; i++){
			len = min(seq, cnt);
			if(!len){
				printf("1 1\n");
				continue;
			}
			printf("%d", len);
			for(int i = 0; i < len&& cnt; i++, cnt--) printf(" %d", path[cnt]);
			printf("\n");
		}
	}
	return 0;
}


/*s1p8*/
#pragma warning(disable:4996)

#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <time.h>

#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <vector>
#include <bitset>
#include <utility>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

//using namespace std;

const int kMaxn = 100011;

int n, m, vn, t;
std::vector<int> vec[kMaxn];

class Edge {
public:
	int v;
	Edge *next;
	Edge() {}
	Edge(int V, Edge *ne) : v(V), next(ne) {}
} *g[kMaxn];

void AddEdge(int x, int y) {
	g[x] = new Edge(y, g[x]);
	g[y] = new Edge(x, g[y]);
}

void DFS(int x, int fa) {
	vec[vn].push_back(x);
	if (int(vec[vn].size()) == t) ++vn;
	for (Edge *e = g[x]; e; e = e->next) {
		if (e->v == fa) continue;
		DFS(e->v, x);
		vec[vn].push_back(x);
		if (int(vec[vn].size()) == t) ++vn;
	}
}

int main() {
	static int i, j, k, x, y;

	scanf("%d%d%d", &n, &m, &k);
	t = ((n << 1) + k - 1) / k;
	for (i = 1; i <= m; ++i) {
		scanf("%d%d", &x, &y);
		AddEdge(x, y);
	}
	DFS(1, -1);
	for (i = 0; i < k; ++i) {
		if (vec[i].size()) {
			printf("%d", int(vec[i].size()));
			for (j = 0; j < int(vec[i].size()); ++j)
				printf(" %d", vec[i][j]);
			puts("");
		} else
			puts("1 1");
	}

	return 0;
}


/*terl*/
#pragma warning(disable:4996)

#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <time.h>

#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <vector>
#include <bitset>
#include <utility>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

//using namespace std;

const int kMaxn = 200011;

int n, m, vn, t;
char vis[kMaxn];
std::vector<int> vec[kMaxn];

class Edge {
public:
	int v;
	Edge *next;
	Edge() {}
	Edge(int V, Edge *ne) : v(V), next(ne) {}
} *g[kMaxn];

void AddEdge(int x, int y) {
	g[x] = new Edge(y, g[x]);
	g[y] = new Edge(x, g[y]);
}

void DFS(int x) {
	vis[x] = 1;
	vec[vn].push_back(x);
	if (int(vec[vn].size()) == t) ++vn;
	for (Edge *e = g[x]; e; e = e->next) {
		if (vis[e->v]) continue;
		DFS(e->v);
		vec[vn].push_back(x);
		if (int(vec[vn].size()) == t) ++vn;
	}
}

int main() {
	static int i, j, k, x, y;

	scanf("%d%d%d", &n, &m, &k);
	t = ((n << 1) + k - 1) / k;
	for (i = 1; i <= m; ++i) {
		scanf("%d%d", &x, &y);
		AddEdge(x, y);
	}
	memset(vis, 0, sizeof(vis));
	DFS(1);
	for (i = 0; i < k; ++i) {
		if (vec[i].size()) {
			printf("%d", int(vec[i].size()));
			for (j = 0; j < int(vec[i].size()); ++j)
				printf(" %d", vec[i][j]);
			puts("");
		} else
			puts("1 1");
	}

	return 0;
}


/*vcf9*/
#pragma warning(disable:4996)

#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <time.h>

#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <vector>
#include <bitset>
#include <utility>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

//using namespace std;

const int kMaxn = 200011;

int n, m, vn, t;
std::vector<int> vec[kMaxn];

class Edge {
public:
	int v;
	Edge *next;
	Edge() {}
	Edge(int V, Edge *ne) : v(V), next(ne) {}
} *g[kMaxn];

void AddEdge(int x, int y) {
	g[x] = new Edge(y, g[x]);
	g[y] = new Edge(x, g[y]);
}

void DFS(int x, int fa) {
	vec[vn].push_back(x);
	if (int(vec[vn].size()) == t) ++vn;
	for (Edge *e = g[x]; e; e = e->next) {
		if (e->v == fa) continue;
		DFS(e->v, x);
		vec[vn].push_back(x);
		if (int(vec[vn].size()) == t) ++vn;
	}
}

int main() {
	static int i, j, k, x, y;

	scanf("%d%d%d", &n, &m, &k);
	t = ((n << 1) + k - 1) / k;
	for (i = 1; i <= m; ++i) {
		scanf("%d%d", &x, &y);
		AddEdge(x, y);
	}
	DFS(1, -1);
	for (i = 0; i < k; ++i) {
		if (vec[i].size()) {
			printf("%d", int(vec[i].size()));
			for (j = 0; j < int(vec[i].size()); ++j)
				printf(" %d", vec[i][j]);
			puts("");
		} else
			puts("1 1");
	}

	return 0;
}


/*a9em*/
#include<bits/stdc++.h>
using namespace std;
int n, m, k, u, v, num, i, j, h, t, tot, a[400001], Head[200001], Next[400001], Link[400001];
bool flag[200001];
inline void AddEdge(int u, int v)
{
	tot++;
	Next[tot] = Head[u];
	Link[tot] = v;
	Head[u] = tot;
}
void DFS(int x)
{
	int i, j;
	a[++num] = x;
	flag[x] = true;
	for (i = Head[x]; i; i = Next[i])
		if (!flag[j = Link[i]])
		{
			DFS(j);
			a[++num] = x;
		}
}
int main()
{
	scanf("%d%d%d", &n, &m, &k);
	for (i = 1; i <= m; i++)
	{
		scanf("%d%d", &u, &v);
		AddEdge(u, v);
		AddEdge(v, u);
	}
	DFS(1);
	for (i = j = 1; i <= k; i++)
	{
		if (j <= num)
		{
			t = min((int)ceil(n * 2 / k), num - j + 1);
			printf("%d", t);
			for (h = 1; h <= t; h++)
				printf(" %d", a[j++]);
		}
		else
			puts("1 1");
		puts("");
	}
	return 0;
}


/*btqa*/
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;

const int maxn= 2e5 + 10;
vector<int> g[maxn];
bool vis[maxn];
int path[maxn*2], cnt;
void dfs(int rt){
    vis[rt] = 1;
    path[++cnt] = rt;
    for(int i=0, to;i<g[rt].size();i++) {
        to = g[rt][i];
        if(vis[to]) continue;
        dfs(to);
        path[++cnt] = rt;
    }
}
int main(){
    int n, m, k;
    scanf("%d %d %d",&n,&m,&k);
    for(int i=0, u, v;i<m;i++){
        scanf("%d %d",&u,&v);
        g[u].push_back(v);
        g[v].push_back(u);
    }
    dfs(1);
    int seq = (2*n + k-1) / k, len;
    for(int i=0;i<k;i++){
        len = min(seq, cnt);
        if(len == 0) {
            printf("1 1\n");
            continue;
        }
        printf("%d",len);
        for(int i=0;i<len && cnt;i++, cnt--)
            printf(" %d",path[cnt]);
        printf("\n");
    }
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define Get(x,y) scanf("%I64d%I64d",&x,&y);
#define get(x) scanf("%I64d",&x);
#define Gett(x,y) scanf("%d%d",&x,&y);
#define gett(x) scanf("%d",&x);
#define f(i,a,b) for(ll i=a;i<b;i++)
#define f_(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long
#define pb push_back
#define maxm(a,b) a=max(a,b);
#define minm(a,b) a=min(a,b);
#define S second
#define F first
const int N=2e5+9;
int n,m,k,cnt,t,p,x,y,mark[N];
vector<int> g[N],ans;
void dfs(int x,int pr){
	mark[x]=1;
	ans.pb(x);
	f(i,0,g[x].size()){
		if(!mark[g[x][i]]){
			dfs(g[x][i],x);
			ans.pb(x);
		}
	}
}
int main(){
	cin>>n>>m>>k;
	f(i,0,m){
		Gett(x,y);
		g[x].pb(y);
		g[y].pb(x);
	}
	t=(2*n+(k-1))/k;
	dfs(1,0);
	f(i,0,k){
		cout<<max(1,min(t,int(ans.size()-p)))<<" ";
		if(p==ans.size()) cout<<1;
		f(i,p,min(p+t,int(ans.size())))
			cout<<ans[i]<<" ";
		cout<<endl;
		p=min(p+t,int(ans.size()));
	}
}


#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define Get(x,y) scanf("%I64d%I64d",&x,&y);
#define get(x) scanf("%I64d",&x);
#define Gett(x,y) scanf("%d%d",&x,&y);
#define gett(x) scanf("%d",&x);
#define f(i,a,b) for(ll i=a;i<b;i++)
#define f_(i,a,b) for(ll i=a;i>=b;i--)
#define ll long long
#define pb push_back
#define maxm(a,b) a=max(a,b);
#define minm(a,b) a=min(a,b);
#define S second
#define F first
const int N=2e5+9;
int n,m,k,cnt,t,p,x,y;
vector<int> g[N],ans;
void dfs(int x,int pr){
	ans.pb(x);
	f(i,0,g[x].size()){
		if(g[x][i]!=pr){
			dfs(g[x][i],x);
			ans.pb(x);
		}
	}
}
int main(){
	cin>>n>>m>>k;
	f(i,0,m){
		Gett(x,y);
		g[x].pb(y);
		g[y].pb(x);
	}
	t=(2*n+(k-1))/k;
	dfs(1,0);
	f(i,0,k){
		cout<<max(1,min(t,int(ans.size()-p)))<<" ";
		if(p==ans.size()) cout<<1;
		f(i,p,min(p+t,int(ans.size())))
			cout<<ans[i]<<" ";
		cout<<endl;
		p=min(p+t,int(ans.size()));
	}
}


#include <bits/stdc++.h>
#define ll  long long int
#define ld  double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_stdio(false)
#define INF INT_MAX

using namespace std;

set<ll> adj[200010];
set<ll>::iterator ii;
bool vis[200010];
vector<ll> path;
ll went;

void dfs(ll n)
{
	vis[n] = 1;
	path.pb(n);
	for(set<ll>::iterator ii = adj[n].begin(); ii != adj[n].end(); ii++)
	{

		if(!vis[*ii])
		{
			ll x = *ii;
			dfs(x);
			path.pb(n);
		}
	}

}

int main()
{
	ll n, m, k, x, y;
	cin>>n>>m>>k;
	mem(vis);
	for(ll i = 0; i < m; i++)
	{
		cin>>x>>y;
		if(x != y)
		{
			adj[x].insert(y);
			adj[y].insert(x);
		}
	}
	// for(ll i = 1; i <= n; i++)
	// {
	// 	for(ii = adj[i].begin(); ii != adj[i].end(); ii++)
	// 		cout<<*ii<<" ";
	// 	cout<<endl;
	// }
	dfs(1);
	// for(ll i = 0; i<path.size(); i++)
	// 	cout<<path[i]<<" ";
	// cout<<endl;
	ll ind = 0;
	ll kk = ((2*n)%k) == 0 ? ((2*n)/k) : ((2*n)/k + 1) ;
	for(ll i = 1 ; i<=k; i++)
	{
		cout<<min((int)(kk), (int)path.size()-(int)ind)<<" ";
		for(ll j = ind; j<min((int)(ind+kk), (int)path.size()); j++)
			cout<<path[j]<<" ";
		ind += kk;
		cout<<endl;

	}
	return 0;
}


#include <bits/stdc++.h>
#define ll  long long int
#define ld  double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_stdio(false)
#define INF INT_MAX

using namespace std;

set<ll> adj[200010];
set<ll>::iterator ii;
bool vis[200010];
vector<ll> path;
ll went;

void dfs(ll n)
{
	vis[n] = 1;
	path.pb(n);
	ll went = 0;
	for(set<ll>::iterator ii = adj[n].begin(); ii != adj[n].end(); ii++)
	{
		went = 0;
		if(!vis[*ii])
		{
			went = 1;
			ll x = *ii;
			dfs(x);
		}
		if(went)
			path.pb(n);

	}

}

int main()
{
	ll n, m, k, x, y;
	cin>>n>>m>>k;
	mem(vis);
	for(ll i = 0; i < m; i++)
	{
		cin>>x>>y;
		if(x != y)
		{
			adj[x].insert(y);
			adj[y].insert(x);
		}
	}
	// for(ll i = 1; i <= n; i++)
	// {
	// 	for(ii = adj[i].begin(); ii != adj[i].end(); ii++)
	// 		cout<<*ii<<" ";
	// 	cout<<endl;
	// }
	dfs(1);
	// for(ll i = 0; i<path.size(); i++)
	// 	cout<<path[i]<<" ";
	// cout<<endl;
	ll ind = 0;
	ll kk = ceil(2*n/k);
	for(ll i = 1 ; i<=k; i++)
	{
		cout<<min((int)(kk), (int)path.size()-(int)ind)<<" ";
		for(ll j = ind; j<min((int)(ind+kk), (int)path.size()); j++)
			cout<<path[j]<<" ";
		ind += kk;
		cout<<endl;
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>

using namespace std;

constexpr int maxn = 3e5;

set<int> g1[maxn];

vector<int> g[maxn];

vector<int> path;
bool was[maxn];

void dfs(int v, int p = -1)
{
    path.push_back(v);
    was[v] = 1;
    for (auto to: g[v]) {
        if (!was[to]) {
            dfs(to);
            path.push_back(v);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        if (a == b) {
            continue;
        }
        g1[a].insert(b);
        g1[b].insert(a);
    }
    for (int i = 0; i < n; ++i) {
        g[i] = vector<int>(g1[i].begin(), g1[i].end());
    }
    dfs(0);
    int u = (((2*n)%k == 0) ? ((2*n)/k) : ((2*n)/k+1));
    int cur = 0;
    int len = int(path.size());
    for (int i = 0; i < k; ++i) {
        int y = min(len-cur, u);
        cout << y << ' ';
        for (int i = 0; i < y; ++i) {
            cout << path[cur++]+1 << ' ';
        }
        cout << '\n';
        if (cur == len) {
            --cur;
        }
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll  long long int
#define ld  double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_stdio(false)
#define INF INT_MAX

using namespace std;

set<ll> adj[200010];
set<ll>::iterator ii;
bool vis[200010];
vector<ll> path;
ll went;

void dfs(ll n)
{
	vis[n] = 1;
	path.pb(n);
	ll went = 0;
	for(set<ll>::iterator ii = adj[n].begin(); ii != adj[n].end(); ii++)
	{
		went = 0;
		if(!vis[*ii])
		{
			went = 1;
			ll x = *ii;
			dfs(x);
		}
		if(went)
			path.pb(n);

	}

}

int main()
{
	ll n, m, k, x, y;
	cin>>n>>m>>k;
	mem(vis);
	for(ll i = 0; i < m; i++)
	{
		cin>>x>>y;
		if(x != y)
		{
			adj[x].insert(y);
			adj[y].insert(x);
		}
	}
	// for(ll i = 1; i <= n; i++)
	// {
	// 	for(ii = adj[i].begin(); ii != adj[i].end(); ii++)
	// 		cout<<*ii<<" ";
	// 	cout<<endl;
	// }
	dfs(1);
	// for(ll i = 0; i<path.size(); i++)
	// 	cout<<path[i]<<" ";
	// cout<<endl;
	ll ind = 0;
	ll kk = ceil(2*n/k);
	for(ll i = 1 ; i<=k; i++)
	{
		if(ind + kk - 1 < path.size())
		{
			cout<<kk<<" ";
			for(ll j = ind; j<=ind + kk - 1; j++)
			{
				cout<<path[j]<<" ";
			}
			cout<<endl;
			ind = ind + kk;
		}
		else
		{
			cout<<path.size() - ind<<" ";
			for(ll j = ind; j < path.size(); j++)
			{
				cout<<path[j]<<" ";
			}
			cout<<endl;
			ind = ind + kk;
		}

	}
	return 0;
}


#include <bits/stdc++.h>
#define ll  long long int
#define ld  double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_stdio(false)
#define INF INT_MAX

using namespace std;

set<ll> adj[200010];
set<ll>::iterator ii;
bool vis[200010];
vector<ll> path;
ll went;

void dfs(ll n)
{
	vis[n] = 1;
	path.pb(n);
	ll went = 0;
	for(set<ll>::iterator ii = adj[n].begin(); ii != adj[n].end(); ii++)
	{
		went = 0;
		if(!vis[*ii])
		{
			went = 1;
			ll x = *ii;
			dfs(x);
		}
		if(went)
			path.pb(n);

	}

}

int main()
{
	ll n, m, k, x, y;
	cin>>n>>m>>k;
	mem(vis);
	for(ll i = 0; i < m; i++)
	{
		cin>>x>>y;
		if(x != y)
		{
			adj[x].insert(y);
			adj[y].insert(x);
		}
	}
	// for(ll i = 1; i <= n; i++)
	// {
	// 	for(ii = adj[i].begin(); ii != adj[i].end(); ii++)
	// 		cout<<*ii<<" ";
	// 	cout<<endl;
	// }
	dfs(1);
	// for(ll i = 0; i<path.size(); i++)
	// 	cout<<path[i]<<" ";
	// cout<<endl;
	ll ind = 0;
	ll kk = ceil(2*n/k);
	for(ll i = 1 ; i<=k; i++)
	{
		cout<<min((int)(kk), (int)path.size()-1-(int)ind)<<" ";
		for(ll j = ind; j<min((int)(ind+kk), (int)path.size()-1); j++)
			cout<<path[j]<<" ";
		ind += kk;
		cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll  long long int
#define ld  double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_stdio(false)
#define INF INT_MAX

using namespace std;

set<ll> adj[200010];
set<ll>::iterator ii;
bool vis[200010];
vector<ll> path;
ll went;

void dfs(ll n)
{
	vis[n] = 1;
	path.pb(n);
	for(set<ll>::iterator ii = adj[n].begin(); ii != adj[n].end(); ii++)
	{

		if(!vis[*ii])
		{
			ll x = *ii;
			dfs(x);
			path.pb(n);
		}
	}

}

int main()
{
	ll n, m, k, x, y;
	cin>>n>>m>>k;
	mem(vis);
	for(ll i = 0; i < m; i++)
	{
		cin>>x>>y;
		if(x != y)
		{
			adj[x].insert(y);
			adj[y].insert(x);
		}
	}
	// for(ll i = 1; i <= n; i++)
	// {
	// 	for(ii = adj[i].begin(); ii != adj[i].end(); ii++)
	// 		cout<<*ii<<" ";
	// 	cout<<endl;
	// }
	dfs(1);
	// for(ll i = 0; i<path.size(); i++)
	// 	cout<<path[i]<<" ";
	// cout<<endl;
	ll ind = 0;
	ll kk = ((2*n)%k) == 0 ? ((2*n)/k) : ((2*n)/k) + 1;
	for(ll i = 1 ; i<=k; i++)
	{
		cout<<min((int)(kk), (int)path.size()-(int)ind)<<" ";
		for(ll j = ind; j<min((int)(ind+kk), (int)path.size()); j++)
			cout<<path[j]<<" ";
		ind += kk;
		cout<<endl;
		if(ind == path.size())
			ind--;
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll  long long int
#define ld  double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_stdio(false)
#define INF INT_MAX

using namespace std;

set<ll> adj[200010];
set<ll>::iterator ii;
bool vis[200010];
vector<ll> path;
ll went;

void dfs(ll n)
{
	vis[n] = 1;
	path.pb(n);
	ll went = 0;
	for(set<ll>::iterator ii = adj[n].begin(); ii != adj[n].end(); ii++)
	{
		went = 0;
		if(!vis[*ii])
		{
			went = 1;
			ll x = *ii;
			dfs(x);
		}
		if(went)
			path.pb(n);

	}

}

int main()
{
	ll n, m, k, x, y;
	cin>>n>>m>>k;
	mem(vis);
	for(ll i = 0; i < m; i++)
	{
		cin>>x>>y;
		if(x != y)
		{
			adj[x].insert(y);
			adj[y].insert(x);
		}
	}
	// for(ll i = 1; i <= n; i++)
	// {
	// 	for(ii = adj[i].begin(); ii != adj[i].end(); ii++)
	// 		cout<<*ii<<" ";
	// 	cout<<endl;
	// }
	dfs(1);
	// for(ll i = 0; i<path.size(); i++)
	// 	cout<<path[i]<<" ";
	// cout<<endl;
	ll ind = 0;
	ll kk = ceil(2*n/k);
	for(ll i = 1 ; i<=k; i++)
	{
		if(ind + kk - 1 < path.size())
		{
			for(ll j = ind; j<=ind + kk - 1; j++)
			{
				cout<<path[j]<<" ";
			}
			cout<<endl;
			ind = ind + kk;
		}
		else
		{
			cout<<path.size() - ind<<" ";
			for(ll j = ind; j < path.size(); j++)
			{
				cout<<path[j]<<" ";
			}
			cout<<endl;
			ind = ind + kk;
		}

	}
	return 0;
}


#include <bits/stdc++.h>
#define ll  long long int
#define ld  double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_stdio(false)
#define INF INT_MAX

using namespace std;

vector<ll> adj[200010];
vector<ll>::iterator ii;
bool vis[200010];
vector<ll> path;
ll went;

void dfs(ll n)
{
	vis[n] = 1;
	path.pb(n);
	for(vector<ll>::iterator ii = adj[n].begin(); ii != adj[n].end(); ii++)
	{

		if(!vis[*ii])
		{
			ll x = *ii;
			dfs(x);
			path.pb(n);
		}
	}

}

int main()
{
	ll n, m, k, x, y;
	cin>>n>>m>>k;
	mem(vis);
	for(ll i = 0; i < m; i++)
	{
		cin>>x>>y;
		if(x != y)
		{
			adj[x].pb(y);
			adj[y].pb(x);
		}
	}
	// for(ll i = 1; i <= n; i++)
	// {
	// 	for(ii = adj[i].begin(); ii != adj[i].end(); ii++)
	// 		cout<<*ii<<" ";
	// 	cout<<endl;
	// }
	dfs(1);
	// for(ll i = 0; i<path.size(); i++)
	// 	cout<<path[i]<<" ";
	// cout<<endl;
	ll ind = 0;
	ll kk = ((2*n)%k) == 0 ? ((2*n)/k) : ((2*n)/k + 1) ;
	ll mi = min((int)(kk), (int)path.size()-(int)ind);
	for(ll i = 1 ; i<=k; i++)
	{
		mi = min((int)(kk), (int)path.size()-(int)ind);
		cout<<mi<<" ";
		for(ll j = ind; j < mi + ind; j++)
			cout<<path[j]<<" ";
		ind += mi;
		cout<<endl;
		if(ind == path.size())
			ind--;

	}
	return 0;
}


#include <bits/stdc++.h>
#define ll  long long int
#define ld  double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_stdio(false)
#define INF INT_MAX

using namespace std;

vector<ll> adj[200010];
vector<ll>::iterator ii;
bool vis[200010];
vector<ll> path;
ll went;

void dfs(ll n)
{
	vis[n] = 1;
	path.pb(n);
	for(vector<ll>::iterator ii = adj[n].begin(); ii != adj[n].end(); ii++)
	{

		if(!vis[*ii])
		{
			ll x = *ii;
			dfs(x);
			path.pb(n);
		}
	}

}

int main()
{
	ll n, m, k, x, y;
	ios;
	cin>>n>>m>>k;
	mem(vis);
	for(ll i = 0; i < m; i++)
	{
		cin>>x>>y;
		if(x != y)
		{
			adj[x].pb(y);
			adj[y].pb(x);
		}
	}
	// for(ll i = 1; i <= n; i++)
	// {
	// 	for(ii = adj[i].begin(); ii != adj[i].end(); ii++)
	// 		cout<<*ii<<" ";
	// 	cout<<endl;
	// }
	dfs(1);
	// for(ll i = 0; i<path.size(); i++)
	// 	cout<<path[i]<<" ";
	// cout<<endl;
	ll ind = 0;
	ll kk = ((2*n)%k) == 0 ? ((2*n)/k) : ((2*n)/k + 1) ;
	ll mi = min((int)(kk), (int)path.size()-(int)ind);
	for(ll i = 1 ; i<=k; i++)
	{
		mi = min((int)(kk), (int)path.size()-(int)ind);
		cout<<mi<<" ";
		for(ll j = ind; j < mi + ind; j++)
			cout<<path[j]<<" ";
		ind += mi;
		cout<<endl;
		if(ind == path.size())
			ind--;

	}
	return 0;
}


#include <bits/stdc++.h>
#define ll  long long int
#define ld  double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_stdio(false)
#define INF INT_MAX

using namespace std;

set<ll> adj[200010];
set<ll>::iterator ii;
bool vis[200010];
vector<ll> path;
ll went;

void dfs(ll n)
{
	vis[n] = 1;
	path.pb(n);
	for(set<ll>::iterator ii = adj[n].begin(); ii != adj[n].end(); ii++)
	{

		if(!vis[*ii])
		{
			ll x = *ii;
			dfs(x);
			path.pb(n);
		}
	}

}

int main()
{
	ll n, m, k, x, y;
	cin>>n>>m>>k;
	mem(vis);
	for(ll i = 0; i < m; i++)
	{
		cin>>x>>y;
		if(x != y)
		{
			adj[x].insert(y);
			adj[y].insert(x);
		}
	}
	// for(ll i = 1; i <= n; i++)
	// {
	// 	for(ii = adj[i].begin(); ii != adj[i].end(); ii++)
	// 		cout<<*ii<<" ";
	// 	cout<<endl;
	// }
	dfs(1);
	// for(ll i = 0; i<path.size(); i++)
	// 	cout<<path[i]<<" ";
	// cout<<endl;
	ll ind = 0;
	ll kk = ceil(2*n/k);
	for(ll i = 1 ; i<=k; i++)
	{
		cout<<min((int)(kk), (int)path.size()-(int)ind)<<" ";
		for(ll j = ind; j<min((int)(ind+kk), (int)path.size()); j++)
			cout<<path[j]<<" ";
		ind += kk;
		cout<<endl;
		if(ind == path.size())
			ind--;
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll  long long int
#define ld  double
#define MOD 1000000007
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define ff first
#define ss second
#define prf(n) printf("%lf\n",n)
#define scf(n) scanf("%lf", &n)
#define ios ios_base::sync_with_stdio(false)
#define INF INT_MAX

using namespace std;

set<ll> adj[200010];
set<ll>::iterator ii;
bool vis[200010];
vector<ll> path;
ll went;

void dfs(ll n)
{
	vis[n] = 1;
	path.pb(n);
	for(set<ll>::iterator ii = adj[n].begin(); ii != adj[n].end(); ii++)
	{

		if(!vis[*ii])
		{
			ll x = *ii;
			dfs(x);
			path.pb(n);
		}
	}

}

int main()
{
	ll n, m, k, x, y;
	cin>>n>>m>>k;
	mem(vis);
	for(ll i = 0; i < m; i++)
	{
		cin>>x>>y;
		if(x != y)
		{
			adj[x].insert(y);
			adj[y].insert(x);
		}
	}
	// for(ll i = 1; i <= n; i++)
	// {
	// 	for(ii = adj[i].begin(); ii != adj[i].end(); ii++)
	// 		cout<<*ii<<" ";
	// 	cout<<endl;
	// }
	dfs(1);
	// for(ll i = 0; i<path.size(); i++)
	// 	cout<<path[i]<<" ";
	// cout<<endl;
	ll ind = 0;
	ll kk = ceil((2*n)/k);
	for(ll i = 1 ; i<=k; i++)
	{
		cout<<min((int)(kk), (int)path.size()-(int)ind)<<" ";
		for(ll j = ind; j<min((int)(ind+kk), (int)path.size()); j++)
			cout<<path[j]<<" ";
		ind += kk;
		cout<<endl;
		if(ind == path.size())
			ind--;
	}
	return 0;
}