class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: G = None
        self.r: C = None
        self.v: B = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.y: D = None
        self.t: G = None
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: F = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: G = None
        self.y: D = None
        self.t: G = None
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.o: F = None
        self.txt = txt

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

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

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

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

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

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