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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: E = None
        self.u: D = None
        self.s: D = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: E = None
        self.u: D = None
        self.s: D = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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