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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

d.u = c
d.w = n
d.x = i
j.w = a
j.v = m
c.u = d
i.v = n
m.v = j
m.x = n
n.z = d
n.s = d
n.y = j
n.v = m
n.u = m
n.q = m
n.p = c
a.t = j
assert i.v.y.w.t.v.v.txt == "j"