public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
String s=sc.nextLine();
StringBuilder sb=new StringBuilder();
int n=s.length();
int j=n-1;
int i=n-1;
while(j>=0){
while(j>=0 && s.charAt(j)!=' '){
j--;
}
sb.append(s.substring(j+1,i+1)+" ");
while(j>=0 && s.charAt(j)==' '){
j--;
}
i=j;
}
sb.deleteCharAt(sb.length()-1);
System.out.println(sb.toString());
}
}