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

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

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

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

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

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

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

i = A("i")
a = B("a")
k = C("k")
m = D("m")
h = E("h")
c = F("c")
d = G("d")

i.z = h
a.p = h
a.q = h
a.w = m
a.z = k
k.u = h
k.z = d
k.r = c
m.p = a
m.z = k
m.x = d
h.v = k
c.r = a
c.v = i
c.q = k
d.s = c
d.o = a
assert a.p.v.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

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

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

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

i = A("i")
a = B("a")
k = C("k")
m = D("m")
h = E("h")
c = F("c")
d = G("d")

i.z = h
a.p = h
a.q = h
a.w = m
a.z = k
k.u = h
k.z = d
k.r = c
m.p = a
m.z = k
m.x = d
h.v = k
c.r = a
c.v = i
c.q = k
d.s = c
d.o = a
assert a.p.v.z.o.txt == "a"