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

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

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

j = A("j")
n = B("n")
c = C("c")

j.u = c
n.s = c
c.t = n
c.u = n
assert j.u.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

j = A("j")
n = B("n")
c = C("c")

j.u = c
n.s = c
c.t = n
c.u = n
assert j.u.t.s.txt == "c"