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

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

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

l = A("l")
k = B("k")
c = C("c")
n = C("n")
h = C("h")
e = B("e")
a = B("a")

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

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

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

l = A("l")
k = B("k")
c = C("c")
n = C("n")
h = C("h")
e = B("e")
a = B("a")

l.q = n
l.y = c
k.t = h
c.t = n
n.t = c
h.t = c
e.t = h
a.t = c
assert c.t.t.t.t.t.t.t.txt == "n"