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

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

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

h = A("h")
i = B("i")
l = C("l")
e = A("e")
n = C("n")

h.q = l
h.w = e
h.y = e
i.w = h
l.t = n
l.y = n
l.x = i
e.q = n
e.w = h
e.y = h
n.t = l
n.y = l
n.x = i
assert l.y.y.x.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: A = None
        self.y: A = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
l = C("l")
e = A("e")
n = C("n")

h.q = l
h.w = e
h.y = e
i.w = h
l.t = n
l.y = n
l.x = i
e.q = n
e.w = h
e.y = h
n.t = l
n.y = l
n.x = i
assert l.y.y.x.w.y.txt == "e"