class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: A = None
        self.t: A = None
        self.u: A = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

f = A("f")
m = B("m")
b = C("b")
g = D("g")
k = E("k")
h = F("h")
n = A("n")
l = F("l")

f.z = g
f.x = n
f.t = n
f.u = n
f.q = l
m.u = l
m.x = l
m.y = b
b.z = f
b.s = f
b.o = l
b.w = k
g.t = b
g.y = n
k.w = m
k.r = m
k.z = b
h.z = b
h.x = b
h.p = f
h.y = f
h.u = k
h.t = g
n.z = g
n.x = f
n.t = f
n.u = f
n.q = h
l.z = b
l.x = b
l.p = n
l.y = n
l.u = k
l.t = g
assert m.x.t.y.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: A = None
        self.t: A = None
        self.u: A = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

f = A("f")
m = B("m")
b = C("b")
g = D("g")
k = E("k")
h = F("h")
n = A("n")
l = F("l")

f.z = g
f.x = n
f.t = n
f.u = n
f.q = l
m.u = l
m.x = l
m.y = b
b.z = f
b.s = f
b.o = l
b.w = k
g.t = b
g.y = n
k.w = m
k.r = m
k.z = b
h.z = b
h.x = b
h.p = f
h.y = f
h.u = k
h.t = g
n.z = g
n.x = f
n.t = f
n.u = f
n.q = h
l.z = b
l.x = b
l.p = n
l.y = n
l.u = k
l.t = g
assert m.x.t.y.t.z.txt == "g"