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

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

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

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

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

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

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

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

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