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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: C = None
        self.p: E = None
        self.r: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: C = None
        self.v: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: G = None
        self.z: A = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.o: C = None
        self.p: E = None
        self.r: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: C = None
        self.v: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: G = None
        self.z: A = None
        self.txt = txt

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

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

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

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