def get_boundaries(clays):
    """Get coordinates boundaries for grid from clays."""
    xes = []
    yes = []
    axises = {
        'x': (xes, yes),
        'y': (yes, xes),
    }
    for clay in clays:
        axis, [axis_value, *other_values] = clay
        first, second = axises[axis]
        first.append(axis_value)
        second.extend(other_values)
    return [(min(values), max(values)) for values in (xes, yes)]