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

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.t: G = None
        self.u: G = None
        self.s: D = None
        self.v: A = None
        self.q: A = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: F = None
        self.t: G = None
        self.u: G = None
        self.s: D = None
        self.v: A = None
        self.q: A = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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