#include <iostream>
#include <vector>
using namespace std;

int main() {
	unsigned N = 5; //number of objects
	vector<unsigned> left, right;
	
	for (unsigned index=0 ;; ++index) {
		left.clear();
		right.clear();
		
		//treat the index as a number in base 3
		//each digit determines the fate of one object
		unsigned digits=index;
		for (int obj=1; obj<=N; ++obj) {
			unsigned pos=digits%3;
			digits /= 3;
			if (pos == 1)
				left.push_back(obj);
			else if (pos == 2)
			    right.push_back(obj);
		}
		
		if (digits) {
			//done all possibilities
			break;
		}
		
		if (left.empty() || right.empty()) {
			// don't want empty left or right
			continue;
		}
			
		//got one -- print it
		cout << "{ {" <<left[0];
		for (size_t i=1; i<left.size(); ++i)
			cout << "," << left[i];
		cout << "}, {" <<right[0];
		for (size_t i=1; i<right.size(); ++i)
			cout << "," << right[i];
		cout << "} }" << endl;
	}
	return 0;
}
