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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: C = None
        self.v: A = None
        self.r: B = None
        self.o: F = None
        self.y: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: C = None
        self.t: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: C = None
        self.v: A = None
        self.r: B = None
        self.o: F = None
        self.y: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: C = None
        self.t: C = None
        self.txt = txt

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

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