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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: F = 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.z: C = None
        self.v: D = None
        self.t: C = None
        self.w: A = None
        self.p: G = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
m = C("m")
b = D("b")
g = E("g")
n = F("n")
k = G("k")

j.w = m
a.v = m
a.u = m
a.p = g
m.x = j
m.w = n
b.v = n
g.z = m
g.t = m
g.v = b
g.w = j
g.p = k
n.y = k
k.x = m
k.t = b
assert a.u.w.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: C = None
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: F = 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.z: C = None
        self.v: D = None
        self.t: C = None
        self.w: A = None
        self.p: G = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
m = C("m")
b = D("b")
g = E("g")
n = F("n")
k = G("k")

j.w = m
a.v = m
a.u = m
a.p = g
m.x = j
m.w = n
b.v = n
g.z = m
g.t = m
g.v = b
g.w = j
g.p = k
n.y = k
k.x = m
k.t = b
assert a.u.w.y.t.txt == "b"