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.z: A = None
        self.v: B = None
        self.txt = txt

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

e.o = h
e.y = a
f.z = a
f.v = h
c.z = e
c.v = f
b.z = a
b.v = f
k.z = e
k.v = b
a.o = k
a.y = e
i.z = e
i.v = k
h.z = a
h.v = f
assert a.o.z.o.v.z.o.v.v.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.z: A = None
        self.v: B = None
        self.txt = txt

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

e.o = h
e.y = a
f.z = a
f.v = h
c.z = e
c.v = f
b.z = a
b.v = f
k.z = e
k.v = b
a.o = k
a.y = e
i.z = e
i.v = k
h.z = a
h.v = f
assert a.o.z.o.v.z.o.v.v.txt == "f"