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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: A = None
        self.p: E = None
        self.v: C = None
        self.x: F = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: A = None
        self.p: E = None
        self.v: C = None
        self.x: F = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

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

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