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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: D = None
        self.s: D = None
        self.v: B = None
        self.o: A = None
        self.x: C = None
        self.u: G = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.y: D = None
        self.s: D = None
        self.v: B = None
        self.o: A = None
        self.x: C = None
        self.u: G = None
        self.txt = txt

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

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

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