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

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

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

l = A("l")
n = B("n")
d = C("d")
k = A("k")

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

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

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

l = A("l")
n = B("n")
d = C("d")
k = A("k")

l.v = n
l.u = n
l.s = k
n.y = d
d.u = l
d.v = l
k.v = n
k.u = n
k.s = l
assert k.s.u.y.txt == "d"