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

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

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

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

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

i = A("i")
m = B("m")
n = C("n")
h = D("h")
b = E("b")
c = C("c")
f = D("f")

i.p = m
i.q = n
i.r = f
i.t = b
m.u = i
m.z = n
n.q = m
n.v = b
n.w = h
h.t = i
h.x = m
h.r = m
h.y = n
h.s = n
b.s = c
b.x = m
b.t = m
b.q = m
b.z = i
c.q = m
c.v = b
c.w = h
f.t = i
f.x = m
f.r = m
f.y = n
f.s = n
assert h.t.q.w.r.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: C = None
        self.r: D = None
        self.t: E = None
        self.txt = txt

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

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

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

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

i = A("i")
m = B("m")
n = C("n")
h = D("h")
b = E("b")
c = C("c")
f = D("f")

i.p = m
i.q = n
i.r = f
i.t = b
m.u = i
m.z = n
n.q = m
n.v = b
n.w = h
h.t = i
h.x = m
h.r = m
h.y = n
h.s = n
b.s = c
b.x = m
b.t = m
b.q = m
b.z = i
c.q = m
c.v = b
c.w = h
f.t = i
f.x = m
f.r = m
f.y = n
f.s = n
assert h.t.q.w.r.z.q.txt == "m"