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

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

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

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

c.y = l
a.y = m
a.s = n
m.t = l
m.x = c
m.w = n
j.y = d
j.s = i
h.y = d
h.s = c
d.t = h
d.x = i
d.w = c
i.y = l
l.y = m
l.s = i
k.y = m
k.s = c
n.y = h
assert a.s.y.s.y.y.w.y.y.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

c.y = l
a.y = m
a.s = n
m.t = l
m.x = c
m.w = n
j.y = d
j.s = i
h.y = d
h.s = c
d.t = h
d.x = i
d.w = c
i.y = l
l.y = m
l.s = i
k.y = m
k.s = c
n.y = h
assert a.s.y.s.y.y.w.y.y.w.y.txt == "l"