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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: D = None
        self.w: E = None
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.y: B = None
        self.u: C = None
        self.q: G = None
        self.t: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: B = None
        self.q: E = None
        self.v: F = None
        self.x: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: D = None
        self.w: E = None
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: G = None
        self.y: B = None
        self.u: C = None
        self.q: G = None
        self.t: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: B = None
        self.q: E = None
        self.v: F = None
        self.x: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.s: A = None
        self.t: B = None
        self.txt = txt

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

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