def exploreField(region, x, y):
    if ((x < 0) or (y < 0)):
        return True
    try:
        if (region[y][x].visited or (not region[y][x].value)):
            return True
    except IndexError:
        return True
    region[y][x].visited = True
    exploreField(region, (y + 1), x)
    exploreField(region, (y - 1), x)
    exploreField(region, y, (x + 1))
    exploreField(region, y, (x - 1))
def exploreField(region, x, y):
    if ((x < 0) or (y < 0)):
        return True
    try:
        if (region[y][x].visited or (not region[y][x].value)):
            return True
    except IndexError:
        return True
    region[y][x].visited = True
    exploreField(region, (y + 1), x)
    exploreField(region, (y - 1), x)
    exploreField(region, y, (x + 1))
    exploreField(region, y, (x - 1))