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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: C = None
        self.o: A = None
        self.x: B = None
        self.txt = txt

g = A("g")
d = B("d")
k = C("k")
a = D("a")
h = E("h")
n = E("n")

g.w = d
g.r = d
g.x = a
g.t = a
d.t = h
d.p = g
k.t = a
k.z = h
k.r = d
a.z = g
a.r = g
a.x = g
a.p = n
a.u = k
h.w = n
h.q = k
h.o = g
h.x = d
n.w = h
n.q = k
n.o = g
n.x = d
assert h.o.t.u.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: B = None
        self.x: D = None
        self.t: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: E = None
        self.q: C = None
        self.o: A = None
        self.x: B = None
        self.txt = txt

g = A("g")
d = B("d")
k = C("k")
a = D("a")
h = E("h")
n = E("n")

g.w = d
g.r = d
g.x = a
g.t = a
d.t = h
d.p = g
k.t = a
k.z = h
k.r = d
a.z = g
a.r = g
a.x = g
a.p = n
a.u = k
h.w = n
h.q = k
h.o = g
h.x = d
n.w = h
n.q = k
n.o = g
n.x = d
assert h.o.t.u.z.w.txt == "n"