import java.util.Scanner;
public class si {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a[];
a = new int[10];
System.out.println("¾ç¼ö10°³¸¦ ÀÔ·ÂÇϼ¼¿ä.");
for(int i=0; i<10; i++){
a[i] = scanner.nextInt();
if (a[i]%3==0)
System.out.print(a[i] + " ");
}
}
}