def input_and_parse(n):
    """
    The function input_and_parse gathers the inputs and parses and then sorts them in
    the order required by reorder(path,dic) function
    Parameters:
        n (int):No. of pages in the PDF file.
    Returns:
       dic :A parsed dictionary.
    """

    print(
        "enter the current page and the page you want it to be on seperate values by a comma ',' \n"
    )
    # store the input in a list and then convert the input string into
    # using map function to convert the data in lists into int values
    lst = list(
        map(lambda x: [int(x[0]), int(x[1])],
            [input().split(',') for _ in range(n)]))
    # Swapping the position of the lst values to better parse it in dictionary
    lst = [[x[1], x[0]] for x in lst]
    lst.sort(key=lambda x: x[0])
    dic = {curr: new for curr, new in lst}
    # now I have sorted the dic to the required needs of reorder function
    return dic