class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.x: B = None
        self.y: G = None
        self.z: G = None
        self.o: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: E = None
        self.s: E = None
        self.q: D = None
        self.z: C = None
        self.v: G = None
        self.r: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: D = None
        self.x: D = None
        self.t: F = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.t: E = None
        self.s: E = None
        self.q: D = None
        self.z: C = None
        self.v: G = None
        self.r: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: D = None
        self.x: D = None
        self.t: F = None
        self.txt = txt

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

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