class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: G = None
        self.v: B = None
        self.u: A = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: G = None
        self.v: B = None
        self.u: A = None
        self.txt = txt

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

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

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