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

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: G = None
        self.txt = txt

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

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

e = A("e")
i = B("i")
n = C("n")
f = D("f")
m = E("m")
d = F("d")
k = G("k")

e.o = n
i.q = f
i.y = f
i.s = f
i.p = n
n.q = d
n.p = i
f.v = e
f.w = e
f.t = e
f.p = k
f.x = d
m.y = i
m.z = k
d.q = k
d.t = n
k.r = n
k.w = n
k.p = f
assert n.p.q.w.o.q.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.p: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: G = None
        self.txt = txt

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

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

e = A("e")
i = B("i")
n = C("n")
f = D("f")
m = E("m")
d = F("d")
k = G("k")

e.o = n
i.q = f
i.y = f
i.s = f
i.p = n
n.q = d
n.p = i
f.v = e
f.w = e
f.t = e
f.p = k
f.x = d
m.y = i
m.z = k
d.q = k
d.t = n
k.r = n
k.w = n
k.p = f
assert n.p.q.w.o.q.q.p.txt == "f"