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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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