class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: A = None
        self.z: C = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

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

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

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