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

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

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

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

l.o = c
l.s = i
l.p = n
d.u = l
d.s = a
d.z = i
j.u = b
j.w = b
b.u = j
b.w = j
n.o = l
n.p = l
n.s = d
a.u = c
a.s = d
a.z = d
m.u = c
m.s = i
m.z = a
i.u = n
i.s = d
i.z = d
c.o = l
c.p = l
c.s = d
assert b.w.w.u.w.u.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: B = None
        self.p: A = None
        self.txt = txt

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

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

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

l.o = c
l.s = i
l.p = n
d.u = l
d.s = a
d.z = i
j.u = b
j.w = b
b.u = j
b.w = j
n.o = l
n.p = l
n.s = d
a.u = c
a.s = d
a.z = d
m.u = c
m.s = i
m.z = a
i.u = n
i.s = d
i.z = d
c.o = l
c.p = l
c.s = d
assert b.w.w.u.w.u.w.w.txt == "j"