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

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

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

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

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

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

n = A("n")
e = B("e")
m = C("m")
i = D("i")
j = E("j")
f = F("f")
h = A("h")

n.z = m
e.t = n
e.r = n
e.z = m
m.v = i
m.s = i
m.w = j
m.r = j
i.r = j
j.z = h
j.v = h
j.r = i
j.s = i
f.t = i
f.s = e
h.z = m
assert f.s.t.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

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

n = A("n")
e = B("e")
m = C("m")
i = D("i")
j = E("j")
f = F("f")
h = A("h")

n.z = m
e.t = n
e.r = n
e.z = m
m.v = i
m.s = i
m.w = j
m.r = j
i.r = j
j.z = h
j.v = h
j.r = i
j.s = i
f.t = i
f.s = e
h.z = m
assert f.s.t.z.w.txt == "j"