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

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

m = A("m")
b = B("b")
l = B("l")
g = B("g")
h = B("h")
e = B("e")
i = A("i")
k = B("k")
c = B("c")
j = B("j")

m.r = l
m.o = i
b.w = k
b.t = i
l.w = b
l.t = m
g.w = l
g.t = i
h.w = b
h.t = i
e.w = l
e.t = m
i.r = e
i.o = m
k.w = c
k.t = i
c.w = h
c.t = i
j.w = b
j.t = m
assert b.w.t.o.r.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: A = None
        self.txt = txt

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

m = A("m")
b = B("b")
l = B("l")
g = B("g")
h = B("h")
e = B("e")
i = A("i")
k = B("k")
c = B("c")
j = B("j")

m.r = l
m.o = i
b.w = k
b.t = i
l.w = b
l.t = m
g.w = l
g.t = i
h.w = b
h.t = i
e.w = l
e.t = m
i.r = e
i.o = m
k.w = c
k.t = i
c.w = h
c.t = i
j.w = b
j.t = m
assert b.w.t.o.r.t.r.txt == "l"