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

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

c = A("c")
m = B("m")
k = B("k")
e = B("e")
l = B("l")
j = B("j")
n = B("n")
g = B("g")

c.s = n
c.w = j
m.y = c
k.y = c
e.y = c
l.y = c
j.y = c
n.y = c
g.y = c
assert m.y.w.y.s.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: B = None
        self.txt = txt

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

c = A("c")
m = B("m")
k = B("k")
e = B("e")
l = B("l")
j = B("j")
n = B("n")
g = B("g")

c.s = n
c.w = j
m.y = c
k.y = c
e.y = c
l.y = c
j.y = c
n.y = c
g.y = c
assert m.y.w.y.s.y.s.txt == "n"