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

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

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

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

k.y = d
k.z = d
k.x = l
d.q = e
d.w = l
d.o = l
e.w = n
j.y = l
j.z = l
j.x = l
a.y = l
a.z = d
a.x = d
n.w = b
b.w = n
l.q = e
l.w = d
l.o = d
assert e.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: B = None
        self.x: B = None
        self.txt = txt

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

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

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

k.y = d
k.z = d
k.x = l
d.q = e
d.w = l
d.o = l
e.w = n
j.y = l
j.z = l
j.x = l
a.y = l
a.z = d
a.x = d
n.w = b
b.w = n
l.q = e
l.w = d
l.o = d
assert e.w.w.w.w.w.w.txt == "b"