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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

g.p = f
g.y = f
g.o = j
g.z = m
g.q = d
f.x = h
f.y = i
f.o = c
f.p = c
f.r = m
d.o = i
d.z = n
j.v = g
j.t = c
j.w = m
j.y = h
j.s = h
m.w = i
m.x = j
m.z = j
h.s = c
h.q = i
i.r = h
i.y = f
n.o = i
n.z = d
k.p = f
k.y = f
k.o = j
k.z = m
k.q = n
c.x = h
c.y = i
c.o = f
c.p = f
c.r = m
assert k.q.o.r.txt == "h"