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

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: A = None
        self.q: A = None
        self.z: A = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

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

a.p = k
a.w = k
a.o = c
a.q = c
e.w = h
e.x = h
e.v = a
e.q = a
e.z = a
k.y = e
h.v = k
h.z = e
c.x = f
c.s = f
c.z = a
c.w = a
c.o = k
c.p = i
c.q = i
i.t = h
i.p = h
i.u = e
i.y = e
i.z = k
i.v = f
i.q = f
f.t = i
f.v = i
assert f.t.u.z.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: E = None
        self.w: C = None
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: A = None
        self.q: A = None
        self.z: A = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

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

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