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

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: B = None
        self.o: D = None
        self.t: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: F = None
        self.txt = txt

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

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

f = A("f")
d = B("d")
n = C("n")
g = D("g")
j = E("j")
k = F("k")
e = C("e")
l = D("l")
i = E("i")

f.z = i
f.o = k
d.z = f
n.w = k
n.t = k
n.x = d
n.o = l
g.z = l
g.y = k
j.q = i
j.t = k
j.x = n
j.z = f
k.w = i
k.x = d
e.w = k
e.t = k
e.x = d
e.o = l
l.z = g
l.y = k
i.q = j
i.t = k
i.x = n
i.z = f
assert n.x.z.z.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.o: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: B = None
        self.o: D = None
        self.t: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: F = None
        self.txt = txt

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

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

f = A("f")
d = B("d")
n = C("n")
g = D("g")
j = E("j")
k = F("k")
e = C("e")
l = D("l")
i = E("i")

f.z = i
f.o = k
d.z = f
n.w = k
n.t = k
n.x = d
n.o = l
g.z = l
g.y = k
j.q = i
j.t = k
j.x = n
j.z = f
k.w = i
k.x = d
e.w = k
e.t = k
e.x = d
e.o = l
l.z = g
l.y = k
i.q = j
i.t = k
i.x = n
i.z = f
assert n.x.z.z.z.o.txt == "k"