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

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

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

j = A("j")
d = B("d")
f = C("f")
k = A("k")
m = B("m")
i = B("i")
n = A("n")
b = B("b")
l = C("l")
a = C("a")

j.u = n
j.q = i
d.u = m
d.x = m
f.y = l
f.v = l
f.w = b
k.u = n
k.q = i
m.u = i
m.x = b
i.u = b
i.x = b
n.u = j
n.q = b
b.u = d
b.x = i
l.y = a
l.v = f
l.w = d
a.y = f
a.v = l
a.w = b
assert n.u.u.u.u.u.q.u.u.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: B = None
        self.txt = txt

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

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

j = A("j")
d = B("d")
f = C("f")
k = A("k")
m = B("m")
i = B("i")
n = A("n")
b = B("b")
l = C("l")
a = C("a")

j.u = n
j.q = i
d.u = m
d.x = m
f.y = l
f.v = l
f.w = b
k.u = n
k.q = i
m.u = i
m.x = b
i.u = b
i.x = b
n.u = j
n.q = b
b.u = d
b.x = i
l.y = a
l.v = f
l.w = d
a.y = f
a.v = l
a.w = b
assert n.u.u.u.u.u.q.u.u.x.x.txt == "b"