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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: G = None
        self.w: F = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: C = None
        self.u: D = None
        self.q: F = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: G = None
        self.w: F = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.y: C = None
        self.u: D = None
        self.q: F = None
        self.o: B = None
        self.txt = txt

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

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

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

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