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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: A = None
        self.o: E = None
        self.x: A = None
        self.txt = txt

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

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

m = A("m")
j = B("j")
n = C("n")
a = D("a")
h = E("h")
i = A("i")
e = D("e")
b = D("b")

m.t = i
j.u = e
j.t = n
j.z = n
j.s = i
n.p = a
n.w = i
n.o = h
n.x = m
a.v = h
a.r = n
h.r = n
h.z = j
i.t = m
e.v = h
e.r = n
b.v = h
b.r = n
assert e.r.p.v.r.p.r.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: A = None
        self.o: E = None
        self.x: A = None
        self.txt = txt

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

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

m = A("m")
j = B("j")
n = C("n")
a = D("a")
h = E("h")
i = A("i")
e = D("e")
b = D("b")

m.t = i
j.u = e
j.t = n
j.z = n
j.s = i
n.p = a
n.w = i
n.o = h
n.x = m
a.v = h
a.r = n
h.r = n
h.z = j
i.t = m
e.v = h
e.r = n
b.v = h
b.r = n
assert e.r.p.v.r.p.r.w.t.txt == "m"