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

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

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

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

i = A("i")
b = B("b")
c = C("c")
j = D("j")
e = A("e")
n = C("n")

i.o = j
b.o = j
b.z = e
b.q = e
c.w = b
c.s = j
c.q = e
j.u = i
e.o = j
n.w = b
n.s = j
n.q = e
assert e.o.u.o.u.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

i = A("i")
b = B("b")
c = C("c")
j = D("j")
e = A("e")
n = C("n")

i.o = j
b.o = j
b.z = e
b.q = e
c.w = b
c.s = j
c.q = e
j.u = i
e.o = j
n.w = b
n.s = j
n.q = e
assert e.o.u.o.u.o.u.txt == "i"