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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: D = None
        self.x: C = 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: B = None
        self.z: A = None
        self.y: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

b.s = g
b.w = c
b.o = c
c.y = a
c.s = i
c.x = g
g.w = h
i.u = c
i.z = a
i.y = b
e.o = a
h.u = c
h.z = a
h.y = a
a.s = g
a.w = c
a.o = c
assert h.z.s.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: B = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: D = None
        self.x: C = 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: B = None
        self.z: A = None
        self.y: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

b.s = g
b.w = c
b.o = c
c.y = a
c.s = i
c.x = g
g.w = h
i.u = c
i.z = a
i.y = b
e.o = a
h.u = c
h.z = a
h.y = a
a.s = g
a.w = c
a.o = c
assert h.z.s.w.z.txt == "a"