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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: B = None
        self.w: F = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: B = None
        self.w: F = None
        self.o: B = None
        self.txt = txt

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

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

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