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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: G = None
        self.s: A = None
        self.w: B = None
        self.q: C = None
        self.v: A = None
        self.y: D = None
        self.txt = txt

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

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

f = A("f")
n = B("n")
a = C("a")
l = D("l")
g = E("g")
m = F("m")
d = G("d")
e = B("e")
b = D("b")
h = C("h")

f.y = b
f.r = d
n.y = m
n.r = m
n.x = f
a.r = e
l.r = h
g.o = m
g.z = d
g.s = f
g.v = f
g.w = n
g.q = h
g.y = b
m.z = l
m.p = b
m.v = a
m.y = d
m.x = d
m.q = h
d.w = g
d.x = g
d.q = m
d.o = h
d.z = e
d.r = e
e.y = m
e.r = m
e.x = f
b.r = h
h.r = e
assert d.q.v.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: G = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: G = None
        self.s: A = None
        self.w: B = None
        self.q: C = None
        self.v: A = None
        self.y: D = None
        self.txt = txt

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

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

f = A("f")
n = B("n")
a = C("a")
l = D("l")
g = E("g")
m = F("m")
d = G("d")
e = B("e")
b = D("b")
h = C("h")

f.y = b
f.r = d
n.y = m
n.r = m
n.x = f
a.r = e
l.r = h
g.o = m
g.z = d
g.s = f
g.v = f
g.w = n
g.q = h
g.y = b
m.z = l
m.p = b
m.v = a
m.y = d
m.x = d
m.q = h
d.w = g
d.x = g
d.q = m
d.o = h
d.z = e
d.r = e
e.y = m
e.r = m
e.x = f
b.r = h
h.r = e
assert d.q.v.r.x.txt == "f"