class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.w: B = None
        self.z: F = None
        self.v: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: F = None
        self.v: C = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.w: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: D = None
        self.p: C = None
        self.z: C = None
        self.v: B = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: F = None
        self.v: C = None
        self.z: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.w: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: D = None
        self.p: C = None
        self.z: C = None
        self.v: B = None
        self.txt = txt

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

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

g.r = m
g.v = m
g.w = f
g.z = h
f.r = i
f.q = a
f.v = n
f.z = e
n.o = a
n.w = g
m.o = c
k.x = e
k.q = e
k.w = f
k.r = i
k.z = m
h.q = m
h.x = m
h.p = n
h.z = e
h.v = f
i.o = h
a.q = m
a.x = m
a.p = e
a.z = n
a.v = f
c.x = e
c.q = e
c.w = f
c.r = i
c.z = m
e.o = h
e.w = g
assert k.x.o.x.txt == "m"