class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: B = None
        self.q: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: F = None
        self.s: F = None
        self.q: C = None
        self.u: E = None
        self.x: C = None
        self.o: D = None
        self.txt = txt

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

g.p = m
g.r = h
g.q = n
h.p = m
h.r = k
c.u = h
c.z = d
m.o = n
e.s = d
e.p = d
e.v = g
e.q = g
e.r = l
e.x = h
e.t = h
d.q = n
d.s = g
n.y = c
n.x = c
n.w = d
n.s = d
n.q = l
n.u = e
n.o = m
l.u = h
l.z = d
k.p = m
k.r = h
k.q = n
assert m.o.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: B = None
        self.q: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: F = None
        self.s: F = None
        self.q: C = None
        self.u: E = None
        self.x: C = None
        self.o: D = None
        self.txt = txt

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

g.p = m
g.r = h
g.q = n
h.p = m
h.r = k
c.u = h
c.z = d
m.o = n
e.s = d
e.p = d
e.v = g
e.q = g
e.r = l
e.x = h
e.t = h
d.q = n
d.s = g
n.y = c
n.x = c
n.w = d
n.s = d
n.q = l
n.u = e
n.o = m
l.u = h
l.z = d
k.p = m
k.r = h
k.q = n
assert m.o.y.z.txt == "d"