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

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.v: G = None
        self.x: E = None
        self.r: C = None
        self.s: C = None
        self.p: D = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: E = None
        self.p: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: E = None
        self.txt = txt

e = A("e")
m = B("m")
b = C("b")
f = D("f")
a = E("a")
i = F("i")
k = G("k")

e.p = k
e.x = i
m.y = k
m.v = k
m.x = a
m.r = b
m.s = b
m.p = f
m.z = f
b.t = m
b.w = a
b.p = f
f.o = b
a.v = e
i.o = k
i.y = f
k.v = m
k.x = a
assert m.z.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: G = None
        self.v: G = None
        self.x: E = None
        self.r: C = None
        self.s: C = None
        self.p: D = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: E = None
        self.p: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: E = None
        self.txt = txt

e = A("e")
m = B("m")
b = C("b")
f = D("f")
a = E("a")
i = F("i")
k = G("k")

e.p = k
e.x = i
m.y = k
m.v = k
m.x = a
m.r = b
m.s = b
m.p = f
m.z = f
b.t = m
b.w = a
b.p = f
f.o = b
a.v = e
i.o = k
i.y = f
k.v = m
k.x = a
assert m.z.o.w.txt == "a"