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

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

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

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

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

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

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

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

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

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

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

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

d.t = l
d.s = l
d.o = g
d.x = g
l.w = d
l.o = b
f.t = l
f.o = d
f.x = d
f.p = b
b.s = g
g.z = f
assert b.s.z.t.o.txt == "b"