def dependency_mapping(dep):
    """
    +-----------+-----------------------------------+
    | EGrid Tag | Dependency Tag                    |
    +===========+===================================+
    | S         | nsub, csubj, csubjpass, dsubjpass |
    +-----------+-----------------------------------+
    | O         | iobj, obj, pobj, dobj             |
    +-----------+-----------------------------------+
    | X         | For any other dependency tag      |
    +-----------+-----------------------------------+
    """
    S = ['nsubj', 'csubj', 'csubjpass', 'dsubjpass']
    O = ['iobj', 'obj', 'pobj', 'dobj']
    if S.count(dep) == 1:
        return 'S'
    if O.count(dep) == 1:
        return 'O'
    return 'X'