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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: A = None
        self.txt = txt

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

b = A("b")
n = B("n")
j = C("j")
l = A("l")
e = B("e")
k = A("k")
m = C("m")
a = A("a")

b.r = e
b.u = e
n.p = a
n.y = l
j.y = b
j.z = m
l.r = n
l.u = e
e.p = k
e.y = a
k.r = e
k.u = e
m.y = k
m.z = j
a.r = n
a.u = e
assert m.z.y.u.y.u.y.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: A = None
        self.txt = txt

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

b = A("b")
n = B("n")
j = C("j")
l = A("l")
e = B("e")
k = A("k")
m = C("m")
a = A("a")

b.r = e
b.u = e
n.p = a
n.y = l
j.y = b
j.z = m
l.r = n
l.u = e
e.p = k
e.y = a
k.r = e
k.u = e
m.y = k
m.z = j
a.r = n
a.u = e
assert m.z.y.u.y.u.y.r.p.txt == "a"