class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.r: D = None
        self.p: F = None
        self.u: C = None
        self.t: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

n = A("n")
g = B("g")
d = C("d")
b = D("b")
c = E("c")
e = F("e")
i = G("i")

n.w = i
n.r = b
n.p = e
n.u = d
n.t = c
g.r = b
g.z = b
g.y = d
d.z = n
d.y = n
d.x = e
b.z = n
b.q = c
b.w = i
c.o = g
e.q = i
i.u = g
assert g.r.w.u.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.r: D = None
        self.p: F = None
        self.u: C = None
        self.t: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

n = A("n")
g = B("g")
d = C("d")
b = D("b")
c = E("c")
e = F("e")
i = G("i")

n.w = i
n.r = b
n.p = e
n.u = d
n.t = c
g.r = b
g.z = b
g.y = d
d.z = n
d.y = n
d.x = e
b.z = n
b.q = c
b.w = i
c.o = g
e.q = i
i.u = g
assert g.r.w.u.y.z.txt == "n"