class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.z: A = None
        self.w: B = None
        self.q: C = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.z: A = None
        self.w: B = None
        self.q: C = None
        self.t: C = None
        self.txt = txt

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

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

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