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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

h.y = n
h.q = j
h.u = b
h.z = b
j.p = b
j.v = b
j.x = h
j.r = a
a.v = b
a.t = e
a.p = n
a.z = n
a.u = h
b.r = n
d.q = b
n.v = b
n.t = e
n.p = a
n.z = a
n.u = h
e.q = b
assert h.z.r.z.p.u.u.txt == "b"