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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: D = None
        self.v: C = None
        self.z: C = None
        self.y: C = None
        self.q: F = None
        self.txt = txt

a = A("a")
l = B("l")
e = C("e")
d = D("d")
f = E("f")
g = F("g")
c = G("c")

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: D = None
        self.v: C = None
        self.z: C = None
        self.y: C = None
        self.q: F = None
        self.txt = txt

a = A("a")
l = B("l")
e = C("e")
d = D("d")
f = E("f")
g = F("g")
c = G("c")

a.x = g
l.s = g
e.r = g
e.s = f
e.x = d
d.r = g
d.p = a
d.v = a
d.y = e
d.w = l
d.s = f
f.r = c
f.q = l
f.w = d
f.p = e
g.y = l
g.t = d
g.q = c
g.s = c
g.o = a
c.s = d
c.u = d
c.v = e
c.z = e
c.y = e
c.q = g
assert l.s.y.s.txt == "g"