#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAX_LENGTH 101
void reverseWords(char sentence[], int n) {
    char* stack[n];
    int top = -1;
    char* word = strtok(sentence, " ");
    while (word != NULL) {
        if (top + 1 >= n) break;
        stack[++top] = word;
        word = strtok(NULL, " ");
    }
    for (int i = top; i >= 0; i--) {
        printf("%s", stack[i]);
        if (i != 0) printf(" ");
    }
    printf("\n");
}
int main() {
    int n;
    if (scanf("%d", &n) != 1 || n < 0) {
        printf("Invalid input\n");
        return 0;
    }
    getchar();
    char sentence[MAX_LENGTH];
    if (fgets(sentence, MAX_LENGTH), stdin == NULL) {
        printf("Invalid input\n");
        return 0;
    }
    size_t len = strlen(sentence);
    if (len > 0 && sentence[len - 1] == '\n') sentence[len - 1] = '\0';
    reverseWords(sentence, n);
    return 0;
}