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

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

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

k = A("k")
i = B("i")
j = C("j")
l = A("l")
e = B("e")
h = C("h")
a = C("a")

k.p = h
i.u = j
i.y = e
j.q = e
l.p = j
e.u = j
e.y = i
h.q = e
a.q = i
assert k.p.q.y.y.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

k = A("k")
i = B("i")
j = C("j")
l = A("l")
e = B("e")
h = C("h")
a = C("a")

k.p = h
i.u = j
i.y = e
j.q = e
l.p = j
e.u = j
e.y = i
h.q = e
a.q = i
assert k.p.q.y.y.u.q.txt == "e"