class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.r: B = None
        self.u: D = None
        self.txt = txt

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

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

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

a = A("a")
d = B("d")
b = C("b")
n = D("n")

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

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

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

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

a = A("a")
d = B("d")
b = C("b")
n = D("n")

a.v = n
a.u = n
a.r = d
d.o = b
d.t = a
b.s = n
b.x = a
b.u = d
n.w = a
n.r = a
n.p = b
n.x = d
assert d.o.s.r.txt == "a"