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

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

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

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

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

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

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

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

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

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

k.o = n
k.x = m
k.s = m
h.z = g
h.t = b
d.p = g
d.w = n
g.o = d
g.v = h
g.t = k
f.p = m
f.w = g
c.o = m
c.x = m
c.s = m
i.o = g
i.x = g
i.s = m
m.o = b
m.v = h
m.t = k
n.o = d
n.v = h
n.t = i
b.p = g
b.w = m
assert h.z.v.z.txt == "g"