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

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

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

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

k = A("k")
b = B("b")
n = C("n")
e = D("e")
c = D("c")
g = D("g")
a = A("a")
f = C("f")
m = B("m")

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

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

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

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

k = A("k")
b = B("b")
n = C("n")
e = D("e")
c = D("c")
g = D("g")
a = A("a")
f = C("f")
m = B("m")

k.v = c
b.s = a
b.x = m
n.o = g
n.s = a
e.w = g
e.x = g
e.t = b
c.w = g
c.x = g
c.t = m
g.w = c
g.x = c
g.t = b
a.v = e
f.o = g
f.s = a
m.s = k
m.x = b
assert m.x.x.s.v.w.w.t.txt == "m"