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

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

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

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

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

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

l = A("l")
c = B("c")
e = C("e")
h = D("h")
j = E("j")
n = F("n")
g = B("g")
a = D("a")
m = F("m")

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

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

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

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

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

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

l = A("l")
c = B("c")
e = C("e")
h = D("h")
j = E("j")
n = F("n")
g = B("g")
a = D("a")
m = F("m")

l.z = c
c.y = n
c.q = l
e.q = j
e.r = c
h.w = a
h.z = l
j.s = l
j.u = a
n.p = h
n.z = m
g.y = n
g.q = l
a.w = h
a.z = l
m.p = h
m.z = n
assert c.y.z.z.p.w.w.w.txt == "a"