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

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

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

h = A("h")
n = B("n")
i = C("i")
f = B("f")
a = A("a")
e = B("e")

h.s = f
n.u = f
i.w = e
i.p = f
i.q = a
f.u = e
a.s = f
e.u = f
assert i.w.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
i = C("i")
f = B("f")
a = A("a")
e = B("e")

h.s = f
n.u = f
i.w = e
i.p = f
i.q = a
f.u = e
a.s = f
e.u = f
assert i.w.u.u.u.u.u.txt == "f"