/* Author: Ben Miller
*  A simple program to find the greatest common divisor of two numbers.
*/

#include <stdio.h>

main () {

	int x, y;

	while (scanf("%d %d", &x, &y) != EOF)
		if (x > 0  && y > 0)
			printf("%6d %6d %4d\n", x, y, gcd(x, y));
}

int gcd (int u, int v) {

	if (v == 0)
		u;
	else
		return (gcd(v, u % v));
}

