class A:
    def __init__(self, txt: str):
        self.y: B = 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.u: A = None
        self.w: A = None
        self.t: A = None
        self.txt = txt

c = A("c")
m = B("m")
h = C("h")

c.y = m
m.o = h
h.u = c
h.w = c
h.t = c
assert m.o.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = 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.u: A = None
        self.w: A = None
        self.t: A = None
        self.txt = txt

c = A("c")
m = B("m")
h = C("h")

c.y = m
m.o = h
h.u = c
h.w = c
h.t = c
assert m.o.u.y.txt == "m"