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

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

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

h = A("h")
k = B("k")
i = C("i")

h.t = i
k.x = h
k.o = i
i.y = h
i.s = h
assert k.x.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

h = A("h")
k = B("k")
i = C("i")

h.t = i
k.x = h
k.o = i
i.y = h
i.s = h
assert k.x.t.y.txt == "h"