• + 0 comments

    Python code-

    #!/bin/python3
    
    import math
    import os
    import random
    import re
    import sys
    
    if __name__ == '__main__':
        n = int(input().strip())
    
        arr = list(map(int, input().rstrip().split()))
    l= len(arr)
    if l in range(1,1001):
        for i in range(l-1, -1, -1):
            if arr[i] in range(1,10001):
                print (arr[i], end=' ')