class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: B = None
        self.x: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

m.v = j
m.z = h
m.x = f
m.q = c
h.s = m
h.r = e
h.v = d
c.p = i
c.v = e
c.o = h
c.s = h
f.s = h
f.r = j
f.p = c
f.u = c
j.v = m
j.z = h
j.x = f
j.q = d
i.s = h
i.r = m
i.p = e
i.u = e
d.p = i
d.v = e
d.o = h
d.s = h
k.s = h
k.r = j
k.p = c
k.u = e
e.p = g
e.v = c
e.o = h
e.s = h
g.s = h
g.r = m
g.p = c
g.u = e
assert e.v.s.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: B = None
        self.x: D = None
        self.q: C = None
        self.txt = txt

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

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

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

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

m.v = j
m.z = h
m.x = f
m.q = c
h.s = m
h.r = e
h.v = d
c.p = i
c.v = e
c.o = h
c.s = h
f.s = h
f.r = j
f.p = c
f.u = c
j.v = m
j.z = h
j.x = f
j.q = d
i.s = h
i.r = m
i.p = e
i.u = e
d.p = i
d.v = e
d.o = h
d.s = h
k.s = h
k.r = j
k.p = c
k.u = e
e.p = g
e.v = c
e.o = h
e.s = h
g.s = h
g.r = m
g.p = c
g.u = e
assert e.v.s.s.q.txt == "c"