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

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: B = None
        self.o: D = None
        self.q: D = None
        self.t: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

a = A("a")
b = B("b")
d = C("d")
l = D("l")
g = E("g")

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

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: B = None
        self.o: D = None
        self.q: D = None
        self.t: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

a = A("a")
b = B("b")
d = C("d")
l = D("l")
g = E("g")

a.u = d
a.p = b
a.o = g
a.t = g
a.x = l
b.z = a
b.w = d
b.q = l
b.x = l
d.v = l
d.o = l
d.q = l
d.u = b
d.t = b
l.q = a
l.p = a
g.s = l
assert a.p.z.o.s.p.txt == "a"