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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

a = A("a")
c = B("c")
b = C("b")
l = D("l")
n = C("n")

a.u = c
c.v = n
c.o = l
b.u = n
b.s = a
l.r = b
n.u = b
n.s = a
assert b.u.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

a = A("a")
c = B("c")
b = C("b")
l = D("l")
n = C("n")

a.u = c
c.v = n
c.o = l
b.u = n
b.s = a
l.r = b
n.u = b
n.s = a
assert b.u.s.u.txt == "c"