class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: D = None
        self.y: B = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: D = None
        self.y: B = None
        self.o: E = None
        self.txt = txt

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

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

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