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

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

e = A("e")
m = B("m")
i = C("i")
a = D("a")
j = E("j")
f = D("f")
b = E("b")

e.o = j
m.z = a
m.q = b
m.w = e
i.o = b
i.v = b
a.x = e
a.y = i
j.o = i
f.x = e
f.y = i
b.o = i
assert j.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

e = A("e")
m = B("m")
i = C("i")
a = D("a")
j = E("j")
f = D("f")
b = E("b")

e.o = j
m.z = a
m.q = b
m.w = e
i.o = b
i.v = b
a.x = e
a.y = i
j.o = i
f.x = e
f.y = i
b.o = i
assert j.o.o.o.o.o.o.o.txt == "i"