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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: F = None
        self.t: B = None
        self.u: C = None
        self.w: C = None
        self.z: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: F = None
        self.t: B = None
        self.u: C = None
        self.w: C = None
        self.z: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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