#include<iostream>
using namespace std;

const int N = 100;

int wan[N];
int yin[N];

//完数返回 1, 盈数返回0 
int find(int n)
{
	int sum = 0;
	for(int i = 1;i < n;i++)
	{
		if(n % i == 0) sum += i;
	}
	if(sum == n)return 1;
	if(sum > n) return 0;
	return -1;
}

int main(void)
{
	int p = 0,q = 0;
	for(int i = 2;i <= 60;i++)
	{
		int select = find(i);
		if(select == 1) wan[p++] = i;
		if(select == 0) yin[q++] = i;
	}
	cout << "E: ";
	for(int i = 0;i < p - 1;i++) cout << wan[i] << " ";
	cout << wan[p - 1];
	puts("");
	cout << "G: ";
	for(int i = 0;i < q - 1;i++) cout << yin[i] << " ";
	cout << yin[q - 1];
	return 0;
}