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

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

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

h = A("h")
i = B("i")
g = C("g")
d = C("d")
k = A("k")
m = B("m")
j = C("j")
e = B("e")

h.y = k
i.r = d
i.q = d
i.w = m
g.w = h
g.o = h
d.w = k
d.o = h
k.y = h
m.r = g
m.q = g
m.w = e
j.w = h
j.o = h
e.r = j
e.q = g
e.w = i
assert g.w.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

h = A("h")
i = B("i")
g = C("g")
d = C("d")
k = A("k")
m = B("m")
j = C("j")
e = B("e")

h.y = k
i.r = d
i.q = d
i.w = m
g.w = h
g.o = h
d.w = k
d.o = h
k.y = h
m.r = g
m.q = g
m.w = e
j.w = h
j.o = h
e.r = j
e.q = g
e.w = i
assert g.w.y.y.y.y.y.y.y.txt == "k"