def dist(loc1, loc2):
    """returns the distance from location loc1 to loc2
    """
    if loc1 == loc2:
        return 0
    if {loc1, loc2} in [{'cs', 'lab'}, {'mr', 'off'}]:
        return 2
    else:
        return 1
