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

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

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

l = A("l")
k = B("k")
e = C("e")
d = C("d")
h = B("h")
j = A("j")
i = B("i")
n = B("n")

l.p = d
k.w = l
k.p = e
k.y = e
e.v = j
e.s = d
e.z = l
d.v = l
d.z = l
d.s = e
h.w = j
h.p = e
h.y = d
j.p = d
i.w = j
i.p = e
i.y = d
n.w = l
n.p = e
n.y = e
assert n.y.z.p.s.z.p.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

l = A("l")
k = B("k")
e = C("e")
d = C("d")
h = B("h")
j = A("j")
i = B("i")
n = B("n")

l.p = d
k.w = l
k.p = e
k.y = e
e.v = j
e.s = d
e.z = l
d.v = l
d.z = l
d.s = e
h.w = j
h.p = e
h.y = d
j.p = d
i.w = j
i.p = e
i.y = d
n.w = l
n.p = e
n.y = e
assert n.y.z.p.s.z.p.s.s.txt == "d"