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

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

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

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

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

h = A("h")
i = B("i")
b = C("b")
c = D("c")
g = E("g")
n = D("n")
k = A("k")

h.x = i
h.r = k
h.w = k
i.s = g
i.p = n
b.w = n
c.u = k
c.s = k
c.z = n
g.q = k
g.z = k
g.v = b
g.w = b
g.p = c
n.u = h
n.s = k
n.z = c
k.x = i
k.r = h
k.w = h
assert b.w.z.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

h = A("h")
i = B("i")
b = C("b")
c = D("c")
g = E("g")
n = D("n")
k = A("k")

h.x = i
h.r = k
h.w = k
i.s = g
i.p = n
b.w = n
c.u = k
c.s = k
c.z = n
g.q = k
g.z = k
g.v = b
g.w = b
g.p = c
n.u = h
n.s = k
n.z = c
k.x = i
k.r = h
k.w = h
assert b.w.z.z.u.txt == "h"