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

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

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

h = A("h")
b = B("b")
i = C("i")
f = C("f")
a = B("a")

h.u = f
h.o = f
h.s = i
b.u = a
b.y = h
b.w = i
i.q = f
i.t = b
f.q = i
f.t = a
a.u = b
a.y = h
a.w = f
assert i.t.w.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: C = None
        self.s: C = None
        self.txt = txt

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

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

h = A("h")
b = B("b")
i = C("i")
f = C("f")
a = B("a")

h.u = f
h.o = f
h.s = i
b.u = a
b.y = h
b.w = i
i.q = f
i.t = b
f.q = i
f.t = a
a.u = b
a.y = h
a.w = f
assert i.t.w.t.w.txt == "i"