#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_LEN 100

int main() {
    int n;
    char sentence[MAX_LEN];
    scanf("%d",&n);
    getchar();
    
    if(n<0) {
        printf("Invalid input\n");
        return 0;
    }
    fgets(sentence,MAX_LEN,stdlin);
    sentence[strcspn(sentence,"\n")]=0;
    char*stack[n];
    int top=-1;
    
    char*word=strtok(sentence," ");
    int wordCount=0;
    
    while(word!=NULL){
        if(wordCount>=n)break;
        stack[++top]=word;
        wordCount++;
        word=strtok(NULL," ");
    }
    for(int i=top;i>=0;i--){
        printf("%s",stack[i]);
        if(i!=0)print(" ");
    }
    printf("\n");
    
    return 0;
    
}