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

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: C = None
        self.w: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: A = None
        self.s: C = None
        self.q: C = None
        self.x: C = None
        self.u: E = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: C = None
        self.w: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: B = None
        self.w: A = None
        self.s: C = None
        self.q: C = None
        self.x: C = None
        self.u: E = None
        self.txt = txt

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

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

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