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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: C = None
        self.w: F = None
        self.u: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: C = None
        self.p: E = None
        self.y: E = None
        self.z: A = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: C = None
        self.w: F = None
        self.u: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: C = None
        self.p: E = None
        self.y: E = None
        self.z: A = None
        self.txt = txt

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

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