#include <cstdio>
#include <algorithm>
using namespace std;

int rank(int a, int b, int c) {
	if (a != b && b == c) swap(a, c);
	if (a != b && a == c) swap(b, c);
	if (a != b) return 0; // no-pair
	if (b != c) { // pair
		return a*14+c;
	} else { // set
		return 14*14+a;
	}
}

int main() {
	const int INF = 14*14*14;
	int a, b, c;
	while (3==scanf("%d%d%d",&a,&b,&c) && a) {
		int r = rank(a, b, c), ans = INF;
		for (int i = 1; i <= 13; ++i) {
			for (int j = i; j <= 13; ++j) {
				for (int k = j; k <= 13; ++k) {
					int t = rank(i, j, k);
					if (t > r && t < ans) {
						ans = t;
						a = i, b = j, c = k;
					}
				}
			}
		}
		if (ans == INF) puts("*");
		else {
			printf("%d %d %d\n", a, b, c);
		}
	}
}
