class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: B = None
        self.u: E = None
        self.z: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: A = None
        self.s: D = None
        self.z: B = None
        self.u: D = None
        self.txt = txt

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

i.x = k
i.y = h
d.v = i
h.y = d
h.r = m
k.w = h
k.p = d
k.u = m
k.z = i
m.p = h
m.t = i
m.s = e
m.u = e
m.z = d
e.w = h
e.p = d
e.u = m
e.z = i
assert h.r.p.r.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: B = None
        self.u: E = None
        self.z: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: A = None
        self.s: D = None
        self.z: B = None
        self.u: D = None
        self.txt = txt

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

i.x = k
i.y = h
d.v = i
h.y = d
h.r = m
k.w = h
k.p = d
k.u = m
k.z = i
m.p = h
m.t = i
m.s = e
m.u = e
m.z = d
e.w = h
e.p = d
e.u = m
e.z = i
assert h.r.p.r.u.z.txt == "i"