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

class B:
    def __init__(self, txt: str):
        self.x: D = 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.w: B = None
        self.t: C = None
        self.v: B = None
        self.u: A = None
        self.txt = txt

b = A("b")
c = B("c")
n = C("n")
d = D("d")
g = C("g")
e = C("e")

b.s = c
b.o = d
c.x = d
n.w = d
d.w = c
d.v = c
d.t = e
d.u = b
g.w = d
e.w = d
assert c.x.v.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = 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.w: B = None
        self.t: C = None
        self.v: B = None
        self.u: A = None
        self.txt = txt

b = A("b")
c = B("c")
n = C("n")
d = D("d")
g = C("g")
e = C("e")

b.s = c
b.o = d
c.x = d
n.w = d
d.w = c
d.v = c
d.t = e
d.u = b
g.w = d
e.w = d
assert c.x.v.x.t.txt == "e"