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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: E = None
        self.p: E = None
        self.u: C = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: E = None
        self.p: E = None
        self.u: C = None
        self.w: D = None
        self.txt = txt

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

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

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