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

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

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

k = A("k")
l = B("l")
e = C("e")

k.s = l
k.u = l
k.t = e
l.x = k
e.v = l
e.r = l
assert l.x.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: C = None
        self.u: B = None
        self.txt = txt

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

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

k = A("k")
l = B("l")
e = C("e")

k.s = l
k.u = l
k.t = e
l.x = k
e.v = l
e.r = l
assert l.x.u.x.txt == "k"