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

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

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

j = A("j")
k = B("k")
m = C("m")
n = A("n")
h = A("h")
g = C("g")
i = C("i")
b = B("b")
a = A("a")
e = B("e")

j.o = k
j.u = i
k.w = j
k.q = e
m.y = i
m.x = b
n.o = b
n.u = m
h.o = e
h.u = g
g.y = m
g.x = k
i.y = m
i.x = k
b.w = a
b.q = k
a.o = e
a.u = i
e.w = j
e.q = b
assert k.w.u.x.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.u: C = None
        self.txt = txt

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

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

j = A("j")
k = B("k")
m = C("m")
n = A("n")
h = A("h")
g = C("g")
i = C("i")
b = B("b")
a = A("a")
e = B("e")

j.o = k
j.u = i
k.w = j
k.q = e
m.y = i
m.x = b
n.o = b
n.u = m
h.o = e
h.u = g
g.y = m
g.x = k
i.y = m
i.x = k
b.w = a
b.q = k
a.o = e
a.u = i
e.w = j
e.q = b
assert k.w.u.x.q.q.txt == "b"