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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: D = None
        self.txt = txt

c = A("c")
e = B("e")
d = C("d")
n = D("n")
a = E("a")
h = F("h")
m = A("m")

c.v = h
c.s = e
c.t = n
e.r = d
d.v = e
d.p = a
d.o = n
n.v = a
a.z = h
h.r = c
h.t = n
m.v = h
m.s = e
m.t = n
assert m.t.v.z.r.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.s: B = None
        self.t: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: D = None
        self.txt = txt

c = A("c")
e = B("e")
d = C("d")
n = D("n")
a = E("a")
h = F("h")
m = A("m")

c.v = h
c.s = e
c.t = n
e.r = d
d.v = e
d.p = a
d.o = n
n.v = a
a.z = h
h.r = c
h.t = n
m.v = h
m.s = e
m.t = n
assert m.t.v.z.r.v.t.txt == "n"