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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: G = None
        self.t: C = None
        self.r: A = None
        self.x: G = None
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.u: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: D = None
        self.r: D = None
        self.z: C = None
        self.x: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: A = None
        self.s: B = None
        self.u: E = None
        self.v: F = None
        self.q: E = None
        self.x: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: G = None
        self.t: C = None
        self.r: A = None
        self.x: G = None
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.u: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: D = None
        self.r: D = None
        self.z: C = None
        self.x: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: A = None
        self.s: B = None
        self.u: E = None
        self.v: F = None
        self.q: E = None
        self.x: F = None
        self.txt = txt

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

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