class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.v: A = None
        self.u: A = None
        self.txt = txt

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

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

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

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

j.o = i
e.z = m
e.s = m
m.y = d
d.w = i
d.v = j
d.u = j
i.w = l
i.x = j
i.z = e
n.w = d
n.u = e
l.x = j
l.z = m
l.r = n
l.y = e
assert l.z.y.v.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.v: A = None
        self.u: A = None
        self.txt = txt

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

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

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

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

j.o = i
e.z = m
e.s = m
m.y = d
d.w = i
d.v = j
d.u = j
i.w = l
i.x = j
i.z = e
n.w = d
n.u = e
l.x = j
l.z = m
l.r = n
l.y = e
assert l.z.y.v.o.w.txt == "l"