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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: A = None
        self.x: B = None
        self.t: B = None
        self.z: B = None
        self.txt = txt

n = A("n")
m = B("m")
h = C("h")
c = D("c")
d = E("d")
f = A("f")
g = C("g")
e = C("e")
i = C("i")

n.x = m
m.o = d
h.v = m
c.t = h
c.w = e
d.q = n
d.r = n
d.x = m
d.t = m
d.z = m
f.x = m
g.v = m
e.v = m
i.v = m
assert c.w.v.o.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: A = None
        self.x: B = None
        self.t: B = None
        self.z: B = None
        self.txt = txt

n = A("n")
m = B("m")
h = C("h")
c = D("c")
d = E("d")
f = A("f")
g = C("g")
e = C("e")
i = C("i")

n.x = m
m.o = d
h.v = m
c.t = h
c.w = e
d.q = n
d.r = n
d.x = m
d.t = m
d.z = m
f.x = m
g.v = m
e.v = m
i.v = m
assert c.w.v.o.r.x.txt == "m"