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

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

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

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

i = A("i")
h = B("h")
l = C("l")
k = D("k")
c = C("c")
d = C("d")
b = B("b")
g = D("g")

i.s = k
i.w = l
i.o = h
h.t = l
h.w = c
h.y = b
h.s = b
l.o = d
k.r = i
k.y = c
k.s = c
k.o = g
c.o = d
d.o = l
b.t = l
b.w = l
b.y = h
b.s = h
g.r = i
g.y = l
g.s = l
g.o = k
assert i.w.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: C = None
        self.o: B = None
        self.txt = txt

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

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

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

i = A("i")
h = B("h")
l = C("l")
k = D("k")
c = C("c")
d = C("d")
b = B("b")
g = D("g")

i.s = k
i.w = l
i.o = h
h.t = l
h.w = c
h.y = b
h.s = b
l.o = d
k.r = i
k.y = c
k.s = c
k.o = g
c.o = d
d.o = l
b.t = l
b.w = l
b.y = h
b.s = h
g.r = i
g.y = l
g.s = l
g.o = k
assert i.w.o.o.o.o.o.o.txt == "l"