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

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

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

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

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

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

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

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

j.r = n
j.u = k
j.y = c
h.t = n
h.u = g
h.q = c
n.r = l
l.r = g
e.t = l
e.u = n
e.q = j
g.r = n
c.r = n
c.u = k
c.y = j
k.r = n
k.u = j
k.y = j
assert c.r.r.r.r.r.r.r.txt == "n"