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

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: A = None
        self.p: E = None
        self.t: E = None
        self.v: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.txt = txt

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

h = A("h")
g = B("g")
e = C("e")
m = D("m")
f = E("f")
l = F("l")

h.v = e
g.z = l
g.o = h
g.p = f
g.t = f
g.v = e
e.w = g
e.s = g
m.w = f
m.t = f
m.y = g
f.q = e
f.p = h
l.s = e
l.r = f
assert m.y.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: A = None
        self.p: E = None
        self.t: E = None
        self.v: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.p: A = None
        self.txt = txt

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

h = A("h")
g = B("g")
e = C("e")
m = D("m")
f = E("f")
l = F("l")

h.v = e
g.z = l
g.o = h
g.p = f
g.t = f
g.v = e
e.w = g
e.s = g
m.w = f
m.t = f
m.y = g
f.q = e
f.p = h
l.s = e
l.r = f
assert m.y.z.s.txt == "e"