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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: D = None
        self.x: B = None
        self.z: E = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: B = None
        self.u: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: B = None
        self.txt = txt

h = A("h")
n = B("n")
a = C("a")
m = D("m")
j = E("j")

h.q = j
n.z = j
a.q = m
a.p = m
a.x = n
a.o = n
a.z = j
m.z = n
m.y = n
m.u = n
j.v = n
j.s = n
assert h.q.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: D = None
        self.x: B = None
        self.z: E = None
        self.o: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: B = None
        self.u: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.s: B = None
        self.txt = txt

h = A("h")
n = B("n")
a = C("a")
m = D("m")
j = E("j")

h.q = j
n.z = j
a.q = m
a.p = m
a.x = n
a.o = n
a.z = j
m.z = n
m.y = n
m.u = n
j.v = n
j.s = n
assert h.q.v.z.txt == "j"