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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: A = None
        self.s: D = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
j = C("j")
k = D("k")
n = E("n")
a = E("a")
h = E("h")
c = C("c")

g.w = k
g.t = f
f.v = k
f.s = k
f.q = g
j.t = g
j.s = g
j.x = c
k.o = f
k.w = g
n.o = j
n.w = k
a.o = j
a.w = k
h.o = c
h.w = k
c.t = g
c.s = g
c.x = j
assert n.o.s.w.w.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.t: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: A = None
        self.s: D = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
j = C("j")
k = D("k")
n = E("n")
a = E("a")
h = E("h")
c = C("c")

g.w = k
g.t = f
f.v = k
f.s = k
f.q = g
j.t = g
j.s = g
j.x = c
k.o = f
k.w = g
n.o = j
n.w = k
a.o = j
a.w = k
h.o = c
h.w = k
c.t = g
c.s = g
c.x = j
assert n.o.s.w.w.t.s.txt == "k"