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

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: G = None
        self.t: E = None
        self.p: E = None
        self.w: A = None
        self.q: B = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.u: A = None
        self.y: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: G = None
        self.t: E = None
        self.p: E = None
        self.w: A = None
        self.q: B = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.u: A = None
        self.y: D = None
        self.txt = txt

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

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