#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main() {
    char n_str[10];
    char sentence[101];
    char words[20][101];
    int n, count = 0;
    fgets(n_str, sizeof(n_str), stdin);
    n_str[strcspn(n_str, "\n")] = '\0';
    n = atoi(n_str);
    if(n <= 0){
        printf("Invalid input");
        return 0;
    }
    fgets(sentence, sizeof(sentence), stdin);
    sentence[strcspn(sentence, "\n")] = '\0';
    char *token = strtok(sentence, " ");
    while(tokem != NULL){
        strcpy(words[count], token);
        count++;
        tokem = strkok(NULL, " ");
    }
    if(count > n){
        printf("Invalid input");
        return 0;
    }
    for(int i = count - 1; i > = 0; i--){
        printf("%s", word[i]);
        if(i != 0) 
        printf(" ")
    }
    return 0;
}