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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: A = None
        self.s: A = None
        self.txt = txt

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

j.w = h
j.t = h
j.r = m
l.s = e
l.r = h
l.u = f
f.z = h
n.w = m
n.z = h
h.y = m
h.v = m
h.s = j
a.z = h
b.w = m
b.z = h
m.w = h
m.t = h
m.r = e
e.w = h
e.t = h
e.r = j
assert a.z.s.r.w.y.t.s.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: A = None
        self.t: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: A = None
        self.s: A = None
        self.txt = txt

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

j.w = h
j.t = h
j.r = m
l.s = e
l.r = h
l.u = f
f.z = h
n.w = m
n.z = h
h.y = m
h.v = m
h.s = j
a.z = h
b.w = m
b.z = h
m.w = h
m.t = h
m.r = e
e.w = h
e.t = h
e.r = j
assert a.z.s.r.w.y.t.s.r.w.txt == "h"