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

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

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

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

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

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

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

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

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