def readtab(fi, ty):
    """Reads a line from file with a space separated list
       of items of type ty

    :param file: input stream, for example sys.stdin
    :param ty: a type, for example int
    :returns: a tuple with elements of type ty
    """
    return tuple(map(ty, fi.readline().split()))
