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

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

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

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

n = A("n")
m = B("m")
a = C("a")
g = D("g")
e = A("e")
h = A("h")
j = D("j")
i = B("i")

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

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

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

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

n = A("n")
m = B("m")
a = C("a")
g = D("g")
e = A("e")
h = A("h")
j = D("j")
i = B("i")

n.t = a
n.x = a
n.w = g
m.y = i
m.v = i
m.x = e
a.v = m
a.z = m
a.w = m
a.p = g
g.p = i
g.u = a
g.o = a
g.s = j
e.t = a
e.x = a
e.w = j
h.t = a
h.x = a
h.w = j
j.p = m
j.u = a
j.o = a
j.s = g
i.y = m
i.v = m
i.x = e
assert m.v.v.x.w.txt == "j"