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

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

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

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

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

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

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

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

g.u = i
i.x = m
i.z = d
i.w = g
i.p = j
j.r = i
n.v = l
d.x = i
d.u = l
m.s = g
m.z = i
m.t = d
l.u = g
l.x = j
assert n.v.u.u.z.x.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: G = None
        self.txt = txt

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

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

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

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

g.u = i
i.x = m
i.z = d
i.w = g
i.p = j
j.r = i
n.v = l
d.x = i
d.u = l
m.s = g
m.z = i
m.t = d
l.u = g
l.x = j
assert n.v.u.u.z.x.w.txt == "g"