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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: A = None
        self.u: B = None
        self.q: A = None
        self.txt = txt

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

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

h.r = n
h.v = f
m.o = h
m.z = n
f.x = n
l.y = h
l.s = h
l.q = h
l.u = m
n.u = h
n.v = e
n.r = l
n.p = l
j.y = h
j.s = h
j.q = h
j.u = m
e.x = n
assert f.x.r.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.v: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: A = None
        self.u: B = None
        self.q: A = None
        self.txt = txt

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

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

h.r = n
h.v = f
m.o = h
m.z = n
f.x = n
l.y = h
l.s = h
l.q = h
l.u = m
n.u = h
n.v = e
n.r = l
n.p = l
j.y = h
j.s = h
j.q = h
j.u = m
e.x = n
assert f.x.r.u.z.txt == "n"