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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

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