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

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

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

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

h.o = e
h.y = m
m.t = a
m.w = a
c.r = e
c.u = a
c.y = a
a.o = c
a.y = m
e.r = c
e.u = a
e.y = a
assert e.r.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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