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

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: A = None
        self.t: A = None
        self.p: E = None
        self.v: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: F = None
        self.q: F = None
        self.p: A = None
        self.u: F = None
        self.z: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: D = None
        self.o: C = None
        self.q: A = None
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: B = None
        self.t: C = None
        self.q: C = None
        self.txt = txt

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

n.x = l
l.s = e
d.u = e
d.q = n
d.t = n
d.p = m
d.v = m
e.s = m
e.o = h
e.q = h
e.u = h
e.z = h
e.p = n
m.y = n
m.z = e
h.y = m
h.x = m
h.s = e
h.o = d
h.q = n
f.z = e
f.u = l
f.t = d
f.q = d
assert l.s.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: A = None
        self.t: A = None
        self.p: E = None
        self.v: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.o: F = None
        self.q: F = None
        self.p: A = None
        self.u: F = None
        self.z: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: D = None
        self.o: C = None
        self.q: A = None
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: B = None
        self.t: C = None
        self.q: C = None
        self.txt = txt

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

n.x = l
l.s = e
d.u = e
d.q = n
d.t = n
d.p = m
d.v = m
e.s = m
e.o = h
e.q = h
e.u = h
e.z = h
e.p = n
m.y = n
m.z = e
h.y = m
h.x = m
h.s = e
h.o = d
h.q = n
f.z = e
f.u = l
f.t = d
f.q = d
assert l.s.s.y.txt == "n"