class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: F = None
        self.v: F = None
        self.q: D = None
        self.p: D = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: B = None
        self.u: F = None
        self.s: F = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.v: B = None
        self.u: F = None
        self.s: F = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

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