class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: F = None
        self.u: G = None
        self.v: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: G = None
        self.p: G = None
        self.s: A = None
        self.txt = txt

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

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

g.r = m
g.p = f
g.u = n
g.v = j
i.v = k
i.w = j
i.s = n
j.v = i
j.t = i
j.w = i
j.q = m
j.p = g
j.u = g
j.r = n
k.q = n
k.o = n
k.s = i
k.u = i
m.p = g
m.r = k
f.v = i
f.y = n
f.p = n
f.s = g
n.q = f
assert i.s.q.v.s.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.p: F = None
        self.u: G = None
        self.v: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: G = None
        self.p: G = None
        self.s: A = None
        self.txt = txt

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

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

g.r = m
g.p = f
g.u = n
g.v = j
i.v = k
i.w = j
i.s = n
j.v = i
j.t = i
j.w = i
j.q = m
j.p = g
j.u = g
j.r = n
k.q = n
k.o = n
k.s = i
k.u = i
m.p = g
m.r = k
f.v = i
f.y = n
f.p = n
f.s = g
n.q = f
assert i.s.q.v.s.q.v.txt == "i"