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

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

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

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

l = A("l")
f = B("f")
g = C("g")
k = D("k")
d = A("d")
h = B("h")
e = B("e")
a = C("a")
j = B("j")
n = D("n")

l.o = k
f.o = n
g.r = a
g.s = l
k.w = n
d.o = n
h.o = n
e.o = k
a.r = g
a.s = l
j.o = k
n.w = k
assert f.o.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

l = A("l")
f = B("f")
g = C("g")
k = D("k")
d = A("d")
h = B("h")
e = B("e")
a = C("a")
j = B("j")
n = D("n")

l.o = k
f.o = n
g.r = a
g.s = l
k.w = n
d.o = n
h.o = n
e.o = k
a.r = g
a.s = l
j.o = k
n.w = k
assert f.o.w.w.w.w.w.w.txt == "n"