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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: G = None
        self.p: D = None
        self.q: F = None
        self.t: E = None
        self.w: B = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: A = None
        self.z: F = None
        self.o: C = None
        self.s: G = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: G = None
        self.p: D = None
        self.q: F = None
        self.t: E = None
        self.w: B = None
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: A = None
        self.z: F = None
        self.o: C = None
        self.s: G = None
        self.x: F = None
        self.txt = txt

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

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

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

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