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

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

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

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

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

f = A("f")
b = B("b")
d = C("d")
a = D("a")
j = E("j")
e = D("e")
n = E("n")
k = D("k")

f.u = e
b.p = d
b.w = d
d.v = a
a.x = d
a.o = n
a.z = b
j.w = a
j.z = b
j.r = n
j.v = n
e.x = d
e.o = n
e.z = b
n.w = e
n.z = b
n.r = j
n.v = j
k.x = d
k.o = j
k.z = b
assert b.w.v.x.v.o.w.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

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

f = A("f")
b = B("b")
d = C("d")
a = D("a")
j = E("j")
e = D("e")
n = E("n")
k = D("k")

f.u = e
b.p = d
b.w = d
d.v = a
a.x = d
a.o = n
a.z = b
j.w = a
j.z = b
j.r = n
j.v = n
e.x = d
e.o = n
e.z = b
n.w = e
n.z = b
n.r = j
n.v = j
k.x = d
k.o = j
k.z = b
assert b.w.v.x.v.o.w.x.v.txt == "a"