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

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.s: G = None
        self.r: B = None
        self.p: B = None
        self.u: F = None
        self.txt = txt

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

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

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

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

d = A("d")
m = B("m")
n = C("n")
j = D("j")
k = E("k")
g = F("g")
l = G("l")

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

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.s: G = None
        self.r: B = None
        self.p: B = None
        self.u: F = None
        self.txt = txt

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

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

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

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

d = A("d")
m = B("m")
n = C("n")
j = D("j")
k = E("k")
g = F("g")
l = G("l")

d.u = n
d.x = m
m.q = j
m.w = l
m.o = n
m.y = d
m.s = d
m.r = k
n.y = l
n.s = l
n.r = m
n.p = m
n.u = g
j.x = g
j.p = g
j.o = l
k.p = g
g.z = k
g.x = d
l.p = d
l.y = g
l.x = n
assert g.x.x.w.txt == "l"