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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: B = None
        self.y: A = None
        self.v: C = None
        self.u: D = None
        self.txt = txt

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

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

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

e.x = h
f.v = j
f.s = j
j.w = e
j.q = g
m.s = h
m.x = e
m.u = j
l.z = m
l.u = m
l.o = f
l.y = e
l.v = j
h.r = j
g.x = j
g.v = m
g.z = e
g.q = h
assert f.s.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: B = None
        self.y: A = None
        self.v: C = None
        self.u: D = None
        self.txt = txt

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

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

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

e.x = h
f.v = j
f.s = j
j.w = e
j.q = g
m.s = h
m.x = e
m.u = j
l.z = m
l.u = m
l.o = f
l.y = e
l.v = j
h.r = j
g.x = j
g.v = m
g.z = e
g.q = h
assert f.s.q.q.txt == "h"