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

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: C = None
        self.w: A = None
        self.r: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: B = None
        self.y: A = None
        self.txt = txt

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

l = A("l")
m = B("m")
e = C("e")
d = D("d")
a = E("a")
n = F("n")
k = C("k")

l.s = m
m.t = k
m.r = l
m.z = l
m.v = d
m.w = n
e.q = n
e.p = k
e.w = l
e.r = m
d.u = e
d.p = a
a.v = n
a.w = m
a.y = l
n.t = e
n.o = d
n.s = d
n.y = m
n.v = l
n.z = l
k.q = n
k.p = e
k.w = l
k.r = m
assert l.s.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: C = None
        self.w: A = None
        self.r: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.w: B = None
        self.y: A = None
        self.txt = txt

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

l = A("l")
m = B("m")
e = C("e")
d = D("d")
a = E("a")
n = F("n")
k = C("k")

l.s = m
m.t = k
m.r = l
m.z = l
m.v = d
m.w = n
e.q = n
e.p = k
e.w = l
e.r = m
d.u = e
d.p = a
a.v = n
a.w = m
a.y = l
n.t = e
n.o = d
n.s = d
n.y = m
n.v = l
n.z = l
k.q = n
k.p = e
k.w = l
k.r = m
assert l.s.w.y.txt == "m"