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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: F = None
        self.q: E = None
        self.y: A = None
        self.txt = txt

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

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

i = A("i")
c = B("c")
e = C("e")
f = D("f")
h = E("h")
g = F("g")
n = E("n")
l = B("l")
k = F("k")
a = B("a")

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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.t: F = None
        self.q: E = None
        self.y: A = None
        self.txt = txt

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

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

i = A("i")
c = B("c")
e = C("e")
f = D("f")
h = E("h")
g = F("g")
n = E("n")
l = B("l")
k = F("k")
a = B("a")

i.z = a
c.q = i
c.z = n
c.r = n
c.w = g
e.p = h
f.s = n
f.t = k
f.q = h
f.y = i
h.z = l
h.r = a
h.p = e
g.q = a
n.z = c
n.r = l
n.p = e
l.q = i
l.z = h
l.r = n
l.w = g
k.q = a
a.q = i
a.z = n
a.r = n
a.w = g
assert e.p.p.p.z.r.z.txt == "c"