from functools import reduce


def query_path(obj, path):
    """Returning the path `path` of the JSON object `obj`. Examples:

    >>>a = {"a": [1, 2, 3], "b": [{"foo": "bar"}]}
    >>>query_path(a, ["a"])
    [1,2,3]
    >>>query_path(a, ["a", 2])
    3
    >>>query_path(a, ["b", 0, "foo"])
    "bar"
    >>>query_path(a, ["b", 0, "foo"]) == a["b"][0]["foo"]
    True
    """
    return reduce(lambda x, y: x[y], path, obj)