class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: G = None
        self.s: C = None
        self.w: E = None
        self.r: C = None
        self.z: G = None
        self.t: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

h = A("h")
l = B("l")
d = C("d")
j = D("j")
b = E("b")
c = F("c")
a = G("a")
g = F("g")

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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.p: G = None
        self.s: C = None
        self.w: E = None
        self.r: C = None
        self.z: G = None
        self.t: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

h = A("h")
l = B("l")
d = C("d")
j = D("j")
b = E("b")
c = F("c")
a = G("a")
g = F("g")

h.x = g
l.y = b
l.w = b
l.p = a
l.z = a
l.s = d
l.r = d
l.t = d
d.s = a
d.p = a
d.t = a
j.q = d
j.w = d
j.u = g
j.p = l
j.y = b
j.v = h
b.v = h
b.u = g
c.w = a
a.x = h
g.w = a
assert a.x.x.w.x.x.w.x.x.txt == "g"