#include
#include
#include
using namespace std;
int main()
{
vector v;
unsigned i;
for(i=0; i<3; i++) v.push_back('A'+i);
prev_permutation(v.begin(), v.end());
do {
for(i=0; i cout << v[i] << endl;
} while(prev_permutation(v.begin(), v.end()));
return 0;
}