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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.y: D = None
        self.z: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

a.o = d
a.s = d
a.t = b
a.w = h
a.p = j
c.s = n
c.y = b
c.z = k
c.w = j
h.z = n
h.v = n
h.w = b
h.u = k
h.p = j
b.u = k
b.w = n
b.q = c
n.q = h
n.z = c
j.z = n
j.v = n
j.w = b
j.u = b
j.p = h
k.u = b
k.w = n
k.q = c
d.o = a
d.s = a
d.t = b
d.w = h
d.p = j
assert d.p.p.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: D = None
        self.w: C = None
        self.s: A = None
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.y: D = None
        self.z: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

a.o = d
a.s = d
a.t = b
a.w = h
a.p = j
c.s = n
c.y = b
c.z = k
c.w = j
h.z = n
h.v = n
h.w = b
h.u = k
h.p = j
b.u = k
b.w = n
b.q = c
n.q = h
n.z = c
j.z = n
j.v = n
j.w = b
j.u = b
j.p = h
k.u = b
k.w = n
k.q = c
d.o = a
d.s = a
d.t = b
d.w = h
d.p = j
assert d.p.p.u.w.txt == "n"