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

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

e = A("e")
a = B("a")
c = A("c")
l = A("l")
f = B("f")
k = B("k")
i = A("i")

e.o = k
e.x = k
a.z = e
a.w = k
c.o = f
c.x = k
l.o = f
l.x = k
f.z = i
f.w = k
k.z = c
k.w = a
i.o = k
i.x = k
assert i.x.z.o.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: B = None
        self.txt = txt

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

e = A("e")
a = B("a")
c = A("c")
l = A("l")
f = B("f")
k = B("k")
i = A("i")

e.o = k
e.x = k
a.z = e
a.w = k
c.o = f
c.x = k
l.o = f
l.x = k
f.z = i
f.w = k
k.z = c
k.w = a
i.o = k
i.x = k
assert i.x.z.o.w.w.w.txt == "k"