class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: A = None
        self.txt = txt

l = A("l")
c = B("c")
g = A("g")
b = A("b")
h = A("h")
i = A("i")

l.y = c
l.p = c
c.y = g
c.t = g
g.y = c
g.p = c
b.y = c
b.p = c
h.y = c
h.p = c
i.y = c
i.p = c
assert c.y.p.t.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: A = None
        self.txt = txt

l = A("l")
c = B("c")
g = A("g")
b = A("b")
h = A("h")
i = A("i")

l.y = c
l.p = c
c.y = g
c.t = g
g.y = c
g.p = c
b.y = c
b.p = c
h.y = c
h.p = c
i.y = c
i.p = c
assert c.y.p.t.y.y.y.txt == "c"