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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: B = None
        self.x: F = None
        self.s: C = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.p: C = None
        self.w: C = None
        self.z: F = None
        self.r: D = None
        self.txt = txt

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

f = A("f")
k = B("k")
d = C("d")
h = D("h")
c = E("c")
b = F("b")
e = A("e")
m = D("m")
a = B("a")
g = F("g")

f.y = a
f.z = k
k.r = d
k.x = d
k.w = d
k.s = c
k.q = a
d.p = g
d.q = b
h.y = g
h.x = g
h.w = a
h.s = d
h.z = c
c.v = d
c.p = d
c.w = d
c.o = m
c.r = m
c.z = g
b.z = g
e.y = k
e.z = a
m.y = b
m.w = k
m.x = g
m.s = d
m.z = c
a.r = d
a.x = d
a.w = d
a.s = c
a.q = k
g.z = b
assert c.p.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: B = None
        self.x: F = None
        self.s: C = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.p: C = None
        self.w: C = None
        self.z: F = None
        self.r: D = None
        self.txt = txt

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

f = A("f")
k = B("k")
d = C("d")
h = D("h")
c = E("c")
b = F("b")
e = A("e")
m = D("m")
a = B("a")
g = F("g")

f.y = a
f.z = k
k.r = d
k.x = d
k.w = d
k.s = c
k.q = a
d.p = g
d.q = b
h.y = g
h.x = g
h.w = a
h.s = d
h.z = c
c.v = d
c.p = d
c.w = d
c.o = m
c.r = m
c.z = g
b.z = g
e.y = k
e.z = a
m.y = b
m.w = k
m.x = g
m.s = d
m.z = c
a.r = d
a.x = d
a.w = d
a.s = c
a.q = k
g.z = b
assert c.p.q.z.txt == "g"