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

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

c = A("c")
l = B("l")
n = A("n")
a = B("a")

c.t = n
c.w = l
l.s = a
l.y = a
n.t = c
n.w = a
a.s = l
a.y = l
assert l.s.s.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: B = None
        self.txt = txt

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

c = A("c")
l = B("l")
n = A("n")
a = B("a")

c.t = n
c.w = l
l.s = a
l.y = a
n.t = c
n.w = a
a.s = l
a.y = l
assert l.s.s.y.y.txt == "l"