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

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

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

l = A("l")
b = B("b")
n = C("n")
a = A("a")
d = B("d")
k = C("k")
h = B("h")
j = B("j")

l.y = n
l.u = k
b.w = n
b.r = n
b.y = l
n.r = j
n.z = k
n.w = k
a.y = n
a.u = n
d.w = k
d.y = a
d.r = n
k.r = j
k.z = n
k.w = n
h.w = k
h.y = a
h.r = n
j.w = k
j.y = l
j.r = n
assert h.r.r.w.w.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: C = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
n = C("n")
a = A("a")
d = B("d")
k = C("k")
h = B("h")
j = B("j")

l.y = n
l.u = k
b.w = n
b.r = n
b.y = l
n.r = j
n.z = k
n.w = k
a.y = n
a.u = n
d.w = k
d.y = a
d.r = n
k.r = j
k.z = n
k.w = n
h.w = k
h.y = a
h.r = n
j.w = k
j.y = l
j.r = n
assert h.r.r.w.w.z.z.txt == "n"