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

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

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

l = A("l")
g = B("g")
d = C("d")
i = C("i")
e = B("e")
c = A("c")
k = A("k")
a = A("a")

l.o = d
l.y = d
g.t = l
g.w = d
d.t = i
d.y = i
d.w = i
i.t = d
i.y = d
i.w = d
e.t = a
e.w = d
c.o = d
c.y = i
k.o = d
k.y = d
a.o = d
a.y = i
assert k.y.w.w.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: C = None
        self.txt = txt

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

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

l = A("l")
g = B("g")
d = C("d")
i = C("i")
e = B("e")
c = A("c")
k = A("k")
a = A("a")

l.o = d
l.y = d
g.t = l
g.w = d
d.t = i
d.y = i
d.w = i
i.t = d
i.y = d
i.w = d
e.t = a
e.w = d
c.o = d
c.y = i
k.o = d
k.y = d
a.o = d
a.y = i
assert k.y.w.w.w.t.txt == "d"