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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: E = None
        self.v: A = None
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

b = A("b")
i = B("i")
g = C("g")
e = D("e")
h = E("h")
a = B("a")

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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: E = None
        self.v: A = None
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

b = A("b")
i = B("i")
g = C("g")
e = D("e")
h = E("h")
a = B("a")

b.x = e
b.u = a
b.w = g
i.o = a
i.r = e
i.z = e
i.s = b
g.q = e
g.t = h
g.v = b
g.s = i
e.p = b
h.p = i
a.o = i
a.r = e
a.z = e
a.s = b
assert h.p.s.w.t.txt == "h"