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

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

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

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

j = A("j")
g = B("g")
h = C("h")
n = D("n")
l = D("l")
d = C("d")
a = A("a")
i = B("i")

j.w = g
g.u = h
g.r = h
g.q = h
g.s = i
h.y = a
h.t = n
n.x = l
n.o = l
n.t = a
l.x = n
l.o = n
l.t = a
d.y = j
d.t = l
a.w = g
i.u = d
i.q = d
i.s = g
i.r = h
assert a.w.u.t.o.o.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
h = C("h")
n = D("n")
l = D("l")
d = C("d")
a = A("a")
i = B("i")

j.w = g
g.u = h
g.r = h
g.q = h
g.s = i
h.y = a
h.t = n
n.x = l
n.o = l
n.t = a
l.x = n
l.o = n
l.t = a
d.y = j
d.t = l
a.w = g
i.u = d
i.q = d
i.s = g
i.r = h
assert a.w.u.t.o.o.t.w.txt == "g"