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

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: F = 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.p: B = None
        self.txt = txt

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

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

f.w = d
f.y = d
f.v = d
f.z = d
f.s = k
e.u = d
e.s = k
e.z = k
e.w = a
e.v = j
e.r = f
j.q = k
j.p = k
g.z = e
d.p = e
k.u = c
k.y = n
k.w = a
c.z = e
a.w = d
a.y = d
a.v = d
a.z = d
a.s = k
n.z = e
assert e.s.w.s.w.s.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: E = None
        self.s: F = None
        self.v: E = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: F = 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.p: B = None
        self.txt = txt

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

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

f.w = d
f.y = d
f.v = d
f.z = d
f.s = k
e.u = d
e.s = k
e.z = k
e.w = a
e.v = j
e.r = f
j.q = k
j.p = k
g.z = e
d.p = e
k.u = c
k.y = n
k.w = a
c.z = e
a.w = d
a.y = d
a.v = d
a.z = d
a.s = k
n.z = e
assert e.s.w.s.w.s.w.s.txt == "k"