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

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

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

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

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

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

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

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

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

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

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

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

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

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

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