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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: G = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: E = None
        self.w: G = None
        self.u: F = None
        self.y: E = None
        self.p: G = None
        self.s: B = None
        self.txt = txt

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

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

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

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

n = A("n")
l = B("l")
m = C("m")
c = D("c")
d = E("d")
b = F("b")
k = G("k")

n.o = k
n.y = l
n.u = c
l.o = n
l.s = n
l.t = k
m.v = d
m.x = d
m.y = d
m.w = k
m.p = k
m.u = b
m.s = l
c.w = d
c.q = d
c.r = n
c.v = m
c.z = m
d.z = c
b.o = n
k.r = d
k.z = b
assert n.o.r.z.z.u.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.y: B = None
        self.u: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.t: G = None
        self.s: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: E = None
        self.w: G = None
        self.u: F = None
        self.y: E = None
        self.p: G = None
        self.s: B = None
        self.txt = txt

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

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

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

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

n = A("n")
l = B("l")
m = C("m")
c = D("c")
d = E("d")
b = F("b")
k = G("k")

n.o = k
n.y = l
n.u = c
l.o = n
l.s = n
l.t = k
m.v = d
m.x = d
m.y = d
m.w = k
m.p = k
m.u = b
m.s = l
c.w = d
c.q = d
c.r = n
c.v = m
c.z = m
d.z = c
b.o = n
k.r = d
k.z = b
assert n.o.r.z.z.u.o.o.txt == "k"