Convert colum to a single raw with spaces

I have a input file with following data:
the script will look for unique RID and create all in single row with single space

RID
123
456
564
654
458
897
568
128
654
897

output
123 456 564 554 458 897 568 128 654

Thanks!

What have you tried?

By the way, one of the numbers in the output doesn’t occur in the input.

with open('input.txt', 'r') as infile:
  line = next(infile)  # skip first line containing "RID"
  unique_rid = set()  # sets don't have duplicates and are fast checking membership (if it already contains the element being inserted)
  for line in infile:
     # Maybe do this only after doing some checks that the input is well-formed
     # Here the `strip()` is to remove the end-line characters.
     # You could check if the line is empty, for example.
     unique_rid.add(line.strip())
  # The ouput
  print(" ".join(unique_rid))

so open should have the path of the file
or can we put input command to enter the path

user_input = Path(input("Enter the path of your file: "))
                                                  ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \uXXXX escape

Yes, you can make the file to be read a user input

from pathlib import Path

user_input = Path(input("Enter the path of your file: "))
with open(user_input, 'r') as infile:
  # ... the rest of the code