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

class B:
    def __init__(self, txt: str):
        self.t: G = None
        self.p: C = None
        self.u: D = None
        self.r: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: E = None
        self.x: B = None
        self.w: C = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: G = None
        self.p: C = None
        self.u: D = None
        self.r: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: E = None
        self.x: B = None
        self.w: C = None
        self.s: A = None
        self.txt = txt

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

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

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

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

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