def getPath(keyword, topicNames, topicPaths, topicIDs):
    """
    Function to get the path of a particular keyword in ACM Tree.

    Parameters:
        keyword (string) - the keyword for which we want the path.
        topicNames (dictionary) - the name of the topic as the key and the topic ID number as value.
        topicPaths (dictionary) - the topic ID as the key, and its parent as value.
        topicIDs (dictionary) - the topic ID as the key, and the topic name as the value.

    Returns:
        path (list) - the path of that keyword (backwards)
    """
    
    topicId = topicNames[keyword]
    path = [keyword]
    topicParent = topicPaths[topicId]

    #Start from the keyword and backtrack until the first parent.
    while topicParent != 0:
        curr = topicIDs[topicParent]
        path.append(curr)
        topicParent = topicPaths[topicParent]

    return path