class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: F = None
        self.t: C = None
        self.x: C = None
        self.p: B = None
        self.z: B = None
        self.txt = txt

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

m.p = l
m.y = k
g.z = m
g.w = b
g.p = b
g.s = a
g.v = a
g.t = i
k.u = a
a.w = m
a.q = m
a.z = b
a.x = l
a.v = l
a.t = i
i.u = l
i.v = g
b.t = m
b.s = m
b.r = g
l.v = b
l.t = k
l.x = k
l.p = g
l.z = g
assert k.u.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.v: F = None
        self.t: C = None
        self.x: C = None
        self.p: B = None
        self.z: B = None
        self.txt = txt

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

m.p = l
m.y = k
g.z = m
g.w = b
g.p = b
g.s = a
g.v = a
g.t = i
k.u = a
a.w = m
a.q = m
a.z = b
a.x = l
a.v = l
a.t = i
i.u = l
i.v = g
b.t = m
b.s = m
b.r = g
l.v = b
l.t = k
l.x = k
l.p = g
l.z = g
assert k.u.v.t.txt == "k"