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

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

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

n = A("n")
g = B("g")
l = C("l")
i = A("i")
c = C("c")
b = B("b")
k = C("k")
m = C("m")
j = C("j")

n.q = c
n.u = i
g.r = b
g.x = n
l.o = g
l.t = n
i.q = k
i.u = n
c.o = g
c.t = n
b.r = g
b.x = n
k.o = g
k.t = i
m.o = b
m.t = n
j.o = b
j.t = i
assert j.o.x.u.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: A = None
        self.txt = txt

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

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

n = A("n")
g = B("g")
l = C("l")
i = A("i")
c = C("c")
b = B("b")
k = C("k")
m = C("m")
j = C("j")

n.q = c
n.u = i
g.r = b
g.x = n
l.o = g
l.t = n
i.q = k
i.u = n
c.o = g
c.t = n
b.r = g
b.x = n
k.o = g
k.t = i
m.o = b
m.t = n
j.o = b
j.t = i
assert j.o.x.u.u.q.txt == "c"