#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<bool> data(8, false);
data[7] = data[6] = data[5] = true;
do {
for (int i = 0 ; i != data.size() ; i++) {
cout << (int)data[i];
}
cout << endl;
} while (next_permutation(data.begin(), data.end()));
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewoJdmVjdG9yPGJvb2w+IGRhdGEoOCwgZmFsc2UpOwogICAgZGF0YVs3XSA9IGRhdGFbNl0gPSBkYXRhWzVdID0gdHJ1ZTsKICAgIGRvIHsKICAgICAgICBmb3IgKGludCBpID0gMCA7IGkgIT0gZGF0YS5zaXplKCkgOyBpKyspIHsKICAgICAgICAgICAgY291dCA8PCAoaW50KWRhdGFbaV07CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgZW5kbDsKICAgIH0gd2hpbGUgKG5leHRfcGVybXV0YXRpb24oZGF0YS5iZWdpbigpLCBkYXRhLmVuZCgpKSk7CglyZXR1cm4gMDsKfQ==