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

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

b = A("b")
l = B("l")
c = A("c")
n = A("n")
m = A("m")
e = A("e")

b.t = c
b.y = l
l.y = b
c.t = e
c.y = l
n.t = e
n.y = l
m.t = e
m.y = l
e.t = m
e.y = l
assert c.t.t.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: B = None
        self.txt = txt

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

b = A("b")
l = B("l")
c = A("c")
n = A("n")
m = A("m")
e = A("e")

b.t = c
b.y = l
l.y = b
c.t = e
c.y = l
n.t = e
n.y = l
m.t = e
m.y = l
e.t = m
e.y = l
assert c.t.t.y.y.y.y.txt == "b"