class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.p: B = None
        self.w: E = None
        self.v: 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.v: B = None
        self.txt = txt

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

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

m = A("m")
n = B("n")
k = C("k")
i = D("i")
e = E("e")
h = D("h")
f = D("f")

m.r = n
m.p = n
m.x = k
m.w = e
m.v = e
n.z = e
k.v = n
i.q = f
e.w = k
h.q = f
f.q = i
assert e.w.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.p: B = None
        self.w: E = None
        self.v: 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.v: B = None
        self.txt = txt

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

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

m = A("m")
n = B("n")
k = C("k")
i = D("i")
e = E("e")
h = D("h")
f = D("f")

m.r = n
m.p = n
m.x = k
m.w = e
m.v = e
n.z = e
k.v = n
i.q = f
e.w = k
h.q = f
f.q = i
assert e.w.v.z.txt == "e"