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

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

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

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

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

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

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

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

e.q = g
e.o = m
a.v = d
a.o = i
a.r = m
a.p = g
a.z = e
g.p = m
b.y = i
b.z = g
b.v = a
m.t = g
d.s = a
d.t = m
i.r = a
i.x = a
i.w = a
i.s = a
i.y = b
i.q = b
i.z = m
assert d.s.r.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

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

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