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

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

e = A("e")
c = B("c")
a = B("a")
g = A("g")
b = B("b")
f = B("f")
j = A("j")
l = B("l")
m = B("m")
d = B("d")

e.o = d
e.y = g
c.u = e
a.u = e
g.o = m
g.y = j
b.u = e
f.u = j
j.o = m
j.y = e
l.u = g
m.u = g
d.u = g
assert c.u.y.y.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: A = None
        self.txt = txt

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

e = A("e")
c = B("c")
a = B("a")
g = A("g")
b = B("b")
f = B("f")
j = A("j")
l = B("l")
m = B("m")
d = B("d")

e.o = d
e.y = g
c.u = e
a.u = e
g.o = m
g.y = j
b.u = e
f.u = j
j.o = m
j.y = e
l.u = g
m.u = g
d.u = g
assert c.u.y.y.o.u.txt == "g"