class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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

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

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

e.q = l
e.w = m
j.x = a
j.u = m
j.p = l
a.x = m
a.u = g
b.z = j
b.v = g
b.x = m
g.w = b
g.p = a
g.r = e
g.v = l
m.v = g
l.v = j
l.r = a
l.w = a
l.x = g
l.q = e
assert b.v.v.q.w.v.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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

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

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

e.q = l
e.w = m
j.x = a
j.u = m
j.p = l
a.x = m
a.u = g
b.z = j
b.v = g
b.x = m
g.w = b
g.p = a
g.r = e
g.v = l
m.v = g
l.v = j
l.r = a
l.w = a
l.x = g
l.q = e
assert b.v.v.q.w.v.r.w.txt == "m"