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

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

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

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

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

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

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

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

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

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

d.p = n
d.s = n
d.o = l
n.v = b
n.u = b
n.o = d
b.t = n
b.y = n
l.u = d
l.p = n
l.y = n
assert d.o.y.o.p.txt == "n"