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

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

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

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

m = A("m")
f = B("f")
h = C("h")
c = D("c")
n = B("n")
d = A("d")
e = D("e")

m.v = h
m.z = h
m.s = d
f.t = h
f.v = h
f.p = c
f.y = n
h.q = e
c.s = h
c.t = n
n.t = h
n.v = h
n.p = e
n.y = f
d.v = h
d.z = h
d.s = m
e.s = h
e.t = n
assert f.v.q.s.q.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: C = None
        self.s: A = None
        self.txt = txt

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

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

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

m = A("m")
f = B("f")
h = C("h")
c = D("c")
n = B("n")
d = A("d")
e = D("e")

m.v = h
m.z = h
m.s = d
f.t = h
f.v = h
f.p = c
f.y = n
h.q = e
c.s = h
c.t = n
n.t = h
n.v = h
n.p = e
n.y = f
d.v = h
d.z = h
d.s = m
e.s = h
e.t = n
assert f.v.q.s.q.s.q.txt == "e"