# Problem Description
This is a point relationship classification problem in a layered grid system. Given two points in a coordinate system, we need to determine their relationship, which falls into one of three categories (A, B, or C) based on their relative layer positions. The layers are organized as concentric squares expanding outward from the origin, where each layer N forms a square with side length N.

# Visual Facts
1. The coordinate system has both x and y axes starting from 0
2. Points are organized in layers (L0 to L4 shown)
3. Three types of relationships are illustrated:
   - "A": Same Layer (orange arrows)
   - "B": Adjacent Layer (green arrows)
   - "C": Non-Adjacent Layer (red arrows)
4. Layer 0 is a single point at the origin (0,0)
5. Each subsequent layer forms a square perimeter
6. Points only exist at integer coordinates
7. The maximum layer shown is L4
8. Each layer N forms a square of side length N

# Visual Patterns
1. Layer Determination Pattern:
   - A point's layer number is determined by the maximum of its x and y coordinates
   - For any point (x,y), its layer = max(abs(x), abs(y))

2. Relationship Classification Rules:
   - "A": Points are on the same layer
         Example: Two points both on L4
   - "B": Points are on consecutive layers
         Example: Point on L2 connected to point on L3
   - "C": Points are separated by at least one layer
         Example: Point on L1 connected to point on L3


# Solution
from typing import Tuple

def layer(x: int, y: int) -> int:
    """
    Determine the layer of a point based on its coordinates.

    Parameters:
        x (int): The x-coordinate of the point.
        y (int): The y-coordinate of the point.

    Returns:
        int: The layer of the point.
    """
    return max(x, y)

def solution(point1: Tuple[int, int], point2: Tuple[int, int]) -> str:
    """
    Determine the relationship between two points based on their layers.
    
    Parameters:
        point1 (Tuple[int, int]): The coordinates of the first point, where both x and y are non-negative integers.
        point2 (Tuple[int, int]): The coordinates of the second point, where both x and y are non-negative integers.
    
    Returns:
        str: Return 'A', 'B'. 'C'.
    """

    x1, y1 = point1
    x2, y2 = point2
    layer1 = layer(x1, y1)
    layer2 = layer(x2, y2)
    if layer1 == layer2:
        return 'A'
    if abs(layer1 - layer2) == 1:
        return 'B'
    return 'C'


# Test Script
def test():
    test_cases = [
        ((2, 0), (2, 1), 'A'),
        ((0, 0), (4, 0), 'C'),
        ((1, 0), (2, 0), 'B'),
        ((0, 0), (0, 0), 'A'),
        ((3, 10), (4, 4), 'C'),
        ((5, 6), (7, 4), 'B'),
        ((9, 9), (9, 10), 'B'),
        ((999, 1002), (1000, 1000), 'C'),
        ((0, 0), (0, 1), 'B'),
        ((0, 0), (1, 0), 'B')
    ]
    for point1, point2, expected_output in test_cases:
        try:
            output = solution(point1, point2)
        except Exception as e:
            error_message = (
                f"An exception occurred while running the test case:\n"
                f"`point1`: {point1}\n"
                f"`point2`: {point2}\n\n"
                f"Exception: '{str(e)}'"
            )
            assert False, error_message

        if output != expected_output:
            error_message = (
                f"The following Test Case failed:\n"
                f"`point1`: {point1}\n" 
                f"`point2`: {point2}\n\n"
                f"Actual Output: {output}\n"
                f"Expected Output: {expected_output}"
            )
            assert False, error_message

test()