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

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: E = None
        self.y: E = None
        self.t: D = None
        self.u: E = None
        self.p: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: E = None
        self.s: E = None
        self.y: G = None
        self.p: D = None
        self.u: F = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.z: E = None
        self.y: E = None
        self.t: D = None
        self.u: E = None
        self.p: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: E = None
        self.s: E = None
        self.y: G = None
        self.p: D = None
        self.u: F = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

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

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

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