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

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

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

h = A("h")
m = B("m")
k = C("k")
j = A("j")

h.u = k
h.t = j
h.s = j
m.o = k
k.q = h
j.u = k
j.t = h
j.s = h
assert h.t.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: A = None
        self.s: A = None
        self.txt = txt

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

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

h = A("h")
m = B("m")
k = C("k")
j = A("j")

h.u = k
h.t = j
h.s = j
m.o = k
k.q = h
j.u = k
j.t = h
j.s = h
assert h.t.t.u.txt == "k"