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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: A = None
        self.y: B = None
        self.q: E = None
        self.o: A = None
        self.x: B = None
        self.s: G = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: A = None
        self.y: B = None
        self.q: E = None
        self.o: A = None
        self.x: B = None
        self.s: G = None
        self.txt = txt

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

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

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