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

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: A = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: A = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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