`#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);

    int activities[100]; // assuming max 100 activities
    for (int i = 0; i < n; i++) {
        scanf("%d", &activities[i]);
    }

    int pos, val;
    scanf("%d", &pos);
    scanf("%d", &val);

    // Check if pos is valid
    if (pos < 0 || pos > n) {
        // Invalid position, print original activities
        for (int i = 0; i < n; i++) {
            printf("%d ", activities[i]);
        }
        printf("\n");
    } else {
        // Shift activities to make room for the new one
        for (int i = n; i > pos; i--) {
            activities[i] = activities[i - 1];
        }
        activities[pos] = val;
        n++;

        // Print updated activities
        for (int i = 0; i < n; i++) {
            printf("%d ", activities[i]);
        }
        printf("\n");
    }

    return 0;
}