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

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

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

k = A("k")
h = B("h")
l = C("l")
f = C("f")
c = A("c")
b = B("b")
n = C("n")
i = C("i")
g = C("g")
e = A("e")

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

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

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

k = A("k")
h = B("h")
l = C("l")
f = C("f")
c = A("c")
b = B("b")
n = C("n")
i = C("i")
g = C("g")
e = A("e")

k.q = f
k.t = e
h.y = c
l.s = b
f.s = b
c.q = i
c.t = k
b.y = e
n.s = h
i.s = h
g.s = b
e.q = n
e.t = c
assert f.s.y.t.q.s.y.t.t.txt == "e"