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

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

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

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

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

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

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

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

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

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

k.x = a
k.y = a
k.v = h
n.o = a
n.s = j
a.z = b
a.w = m
a.y = j
a.r = g
j.s = g
g.s = j
e.o = a
e.s = j
f.o = b
f.s = j
b.z = a
b.w = f
b.y = g
b.r = j
h.x = a
h.y = b
h.v = k
m.o = b
m.s = g
assert n.o.z.r.s.s.s.s.txt == "j"