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

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

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

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

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

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

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

l.t = j
f.t = i
f.s = n
k.y = n
k.z = j
k.x = a
k.o = i
k.w = f
n.z = f
j.r = f
j.p = k
j.u = i
j.z = i
i.z = n
a.r = f
a.p = k
a.u = i
a.z = i
assert n.z.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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

l.t = j
f.t = i
f.s = n
k.y = n
k.z = j
k.x = a
k.o = i
k.w = f
n.z = f
j.r = f
j.p = k
j.u = i
j.z = i
i.z = n
a.r = f
a.p = k
a.u = i
a.z = i
assert n.z.s.z.txt == "f"