class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: D = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: D = None
        self.x: C = None
        self.q: A = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: E = None
        self.z: E = None
        self.s: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: C = None
        self.r: B = None
        self.s: B = None
        self.txt = txt

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

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

d = A("d")
h = B("h")
f = C("f")
b = D("b")
a = E("a")
e = F("e")
j = G("j")
n = A("n")

d.s = h
d.w = b
d.o = n
h.t = f
h.x = f
h.p = b
h.q = n
h.w = a
f.q = h
f.w = a
f.z = a
f.s = e
b.p = e
a.u = f
a.v = f
a.r = h
a.s = h
e.t = a
e.p = a
e.s = h
e.o = f
j.w = e
n.s = h
n.w = b
n.o = d
assert h.p.p.p.u.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: D = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.p: D = None
        self.x: C = None
        self.q: A = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: E = None
        self.z: E = None
        self.s: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: C = None
        self.r: B = None
        self.s: B = None
        self.txt = txt

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

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

d = A("d")
h = B("h")
f = C("f")
b = D("b")
a = E("a")
e = F("e")
j = G("j")
n = A("n")

d.s = h
d.w = b
d.o = n
h.t = f
h.x = f
h.p = b
h.q = n
h.w = a
f.q = h
f.w = a
f.z = a
f.s = e
b.p = e
a.u = f
a.v = f
a.r = h
a.s = h
e.t = a
e.p = a
e.s = h
e.o = f
j.w = e
n.s = h
n.w = b
n.o = d
assert h.p.p.p.u.q.w.txt == "a"