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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: B = None
        self.r: B = None
        self.z: D = None
        self.txt = txt

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

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

k = A("k")
g = B("g")
e = C("e")
j = D("j")
h = E("h")
i = C("i")

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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: B = None
        self.r: B = None
        self.z: D = None
        self.txt = txt

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

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

k = A("k")
g = B("g")
e = C("e")
j = D("j")
h = E("h")
i = C("i")

k.x = j
g.u = e
g.s = j
g.p = k
e.t = j
e.z = j
e.q = g
e.r = g
j.p = i
j.v = i
j.w = g
j.y = g
h.u = g
i.t = j
i.z = j
i.q = g
i.r = g
assert g.u.z.p.txt == "i"