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

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

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

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

f = A("f")
h = B("h")
n = C("n")
j = D("j")
m = B("m")
g = D("g")
i = A("i")
b = A("b")
e = D("e")
k = D("k")

f.w = n
f.s = k
h.v = g
h.p = m
h.o = e
h.w = b
n.x = j
n.z = g
n.s = m
n.t = e
j.q = f
j.r = e
j.t = n
m.v = j
m.p = h
m.o = k
m.w = f
g.q = f
g.r = j
g.t = n
i.w = n
i.s = j
b.w = n
b.s = k
e.q = f
e.r = j
e.t = n
k.q = b
k.r = j
k.t = n
assert m.o.q.s.t.x.r.q.w.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: D = None
        self.txt = txt

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

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

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

f = A("f")
h = B("h")
n = C("n")
j = D("j")
m = B("m")
g = D("g")
i = A("i")
b = A("b")
e = D("e")
k = D("k")

f.w = n
f.s = k
h.v = g
h.p = m
h.o = e
h.w = b
n.x = j
n.z = g
n.s = m
n.t = e
j.q = f
j.r = e
j.t = n
m.v = j
m.p = h
m.o = k
m.w = f
g.q = f
g.r = j
g.t = n
i.w = n
i.s = j
b.w = n
b.s = k
e.q = f
e.r = j
e.t = n
k.q = b
k.r = j
k.t = n
assert m.o.q.s.t.x.r.q.w.z.t.txt == "n"