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

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

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

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

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

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

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

e = A("e")
a = B("a")
f = C("f")
c = D("c")
j = E("j")
g = F("g")
k = G("k")
l = G("l")
h = E("h")

e.w = g
e.p = h
a.p = k
a.x = l
a.w = f
a.v = c
f.p = j
f.o = g
c.q = a
c.s = a
c.t = l
c.u = l
c.o = k
j.p = g
g.w = h
k.v = c
l.v = c
h.p = g
assert f.p.p.w.p.w.p.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

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

e = A("e")
a = B("a")
f = C("f")
c = D("c")
j = E("j")
g = F("g")
k = G("k")
l = G("l")
h = E("h")

e.w = g
e.p = h
a.p = k
a.x = l
a.w = f
a.v = c
f.p = j
f.o = g
c.q = a
c.s = a
c.t = l
c.u = l
c.o = k
j.p = g
g.w = h
k.v = c
l.v = c
h.p = g
assert f.p.p.w.p.w.p.w.p.txt == "g"