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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: C = None
        self.txt = txt

i = A("i")
h = B("h")
f = C("f")
n = D("n")
e = E("e")
j = F("j")
g = E("g")
m = C("m")

i.y = h
i.z = n
h.z = n
h.r = e
h.s = m
f.v = h
f.p = i
f.z = i
f.s = g
f.y = j
f.q = m
n.v = i
e.z = i
e.q = g
e.u = g
e.s = h
e.w = n
j.q = m
j.v = m
g.z = i
g.q = e
g.u = e
g.s = h
g.w = n
m.v = h
m.p = i
m.z = i
m.s = e
m.y = j
m.q = f
assert f.s.q.s.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: C = None
        self.txt = txt

i = A("i")
h = B("h")
f = C("f")
n = D("n")
e = E("e")
j = F("j")
g = E("g")
m = C("m")

i.y = h
i.z = n
h.z = n
h.r = e
h.s = m
f.v = h
f.p = i
f.z = i
f.s = g
f.y = j
f.q = m
n.v = i
e.z = i
e.q = g
e.u = g
e.s = h
e.w = n
j.q = m
j.v = m
g.z = i
g.q = e
g.u = e
g.s = h
g.w = n
m.v = h
m.p = i
m.z = i
m.s = e
m.y = j
m.q = f
assert f.s.q.s.s.z.txt == "i"