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

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

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

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

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

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

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

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

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

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

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

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

c.s = b
c.x = a
b.x = e
b.q = a
b.z = c
b.s = c
b.u = c
e.u = g
e.o = a
e.w = b
g.o = c
g.q = a
g.p = a
a.x = e
a.w = e
a.y = b
a.r = g
assert a.y.x.o.txt == "a"