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

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

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

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

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

m.x = g
m.y = n
m.w = d
k.s = n
k.q = n
k.u = b
k.o = d
d.x = m
d.v = f
d.p = f
d.y = a
g.u = a
b.x = g
b.y = k
b.w = d
h.x = a
h.y = k
h.w = f
f.x = h
f.v = d
f.p = d
f.y = a
n.s = i
n.q = i
n.u = h
n.o = f
i.s = k
i.q = k
i.u = m
i.o = f
a.u = g
assert k.u.y.o.x.w.x.y.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: B = None
        self.w: C = None
        self.txt = txt

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

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

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

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

m.x = g
m.y = n
m.w = d
k.s = n
k.q = n
k.u = b
k.o = d
d.x = m
d.v = f
d.p = f
d.y = a
g.u = a
b.x = g
b.y = k
b.w = d
h.x = a
h.y = k
h.w = f
f.x = h
f.v = d
f.p = d
f.y = a
n.s = i
n.q = i
n.u = h
n.o = f
i.s = k
i.q = k
i.u = m
i.o = f
a.u = g
assert k.u.y.o.x.w.x.y.u.x.u.txt == "g"