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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: E = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: E = None
        self.v: B = None
        self.txt = txt

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

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

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