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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: E = None
        self.o: G = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: E = None
        self.w: E = None
        self.q: G = None
        self.p: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: A = None
        self.t: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: E = None
        self.o: G = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: E = None
        self.w: E = None
        self.q: G = None
        self.p: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: A = None
        self.t: E = None
        self.txt = txt

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

m.u = e
m.p = j
m.x = c
f.y = d
f.z = d
f.o = c
f.p = e
n.x = m
n.v = m
n.y = j
n.u = c
n.r = f
n.w = f
e.y = n
e.p = n
e.v = d
e.w = d
e.q = c
d.q = e
d.s = e
d.t = f
d.z = j
d.u = j
d.p = m
j.w = n
c.r = m
c.p = m
c.t = d
assert j.w.u.r.x.t.txt == "d"