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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.s: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: F = None
        self.v: B = None
        self.u: D = None
        self.z: E = None
        self.x: A = None
        self.o: F = None
        self.txt = txt

l = A("l")
h = B("h")
b = C("b")
a = D("a")
n = E("n")
e = F("e")
g = G("g")

l.v = n
h.z = b
h.y = n
h.s = n
h.r = n
h.o = l
h.t = g
b.z = h
b.u = h
b.y = g
a.r = h
a.u = g
a.s = b
a.t = b
n.x = e
n.s = a
e.t = b
e.w = a
g.t = e
g.w = e
g.o = e
g.v = h
g.u = a
g.z = n
g.x = l
assert h.s.x.t.y.z.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.s: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: F = None
        self.v: B = None
        self.u: D = None
        self.z: E = None
        self.x: A = None
        self.o: F = None
        self.txt = txt

l = A("l")
h = B("h")
b = C("b")
a = D("a")
n = E("n")
e = F("e")
g = G("g")

l.v = n
h.z = b
h.y = n
h.s = n
h.r = n
h.o = l
h.t = g
b.z = h
b.u = h
b.y = g
a.r = h
a.u = g
a.s = b
a.t = b
n.x = e
n.s = a
e.t = b
e.w = a
g.t = e
g.w = e
g.o = e
g.v = h
g.u = a
g.z = n
g.x = l
assert h.s.x.t.y.z.s.u.txt == "g"