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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: C = None
        self.q: E = None
        self.u: D = None
        self.txt = txt

m = A("m")
b = B("b")
f = C("f")
h = D("h")
c = E("c")
e = F("e")
k = A("k")
j = C("j")

m.z = k
b.x = h
b.r = e
b.u = f
f.w = k
f.y = k
f.t = k
f.u = e
h.y = c
h.t = c
h.u = b
h.s = e
h.z = m
c.u = e
e.o = h
e.u = h
e.z = f
e.q = c
k.z = m
j.w = m
j.y = k
j.t = k
j.u = e
assert f.t.z.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: C = None
        self.q: E = None
        self.u: D = None
        self.txt = txt

m = A("m")
b = B("b")
f = C("f")
h = D("h")
c = E("c")
e = F("e")
k = A("k")
j = C("j")

m.z = k
b.x = h
b.r = e
b.u = f
f.w = k
f.y = k
f.t = k
f.u = e
h.y = c
h.t = c
h.u = b
h.s = e
h.z = m
c.u = e
e.o = h
e.u = h
e.z = f
e.q = c
k.z = m
j.w = m
j.y = k
j.t = k
j.u = e
assert f.t.z.z.z.z.z.z.txt == "k"