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

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

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

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

k.t = a
k.q = g
g.r = a
g.y = k
l.s = e
l.x = e
l.o = h
n.s = l
n.x = l
n.o = a
e.s = l
e.x = l
e.o = h
a.r = h
a.y = k
h.r = g
h.y = k
assert g.r.y.t.r.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.q: B = None
        self.txt = txt

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

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

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

k.t = a
k.q = g
g.r = a
g.y = k
l.s = e
l.x = e
l.o = h
n.s = l
n.x = l
n.o = a
e.s = l
e.x = l
e.o = h
a.r = h
a.y = k
h.r = g
h.y = k
assert g.r.y.t.r.y.q.txt == "g"