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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: A = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: D = None
        self.s: D = None
        self.q: A = None
        self.y: C = None
        self.v: F = None
        self.txt = txt

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

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

h.t = j
h.v = e
j.v = e
j.t = a
j.w = d
d.v = j
d.z = h
d.q = h
e.z = h
a.t = j
a.o = e
a.s = e
a.q = h
a.y = d
a.v = g
g.o = a
g.s = d
assert d.q.t.t.s.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: A = None
        self.q: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: D = None
        self.s: D = None
        self.q: A = None
        self.y: C = None
        self.v: F = None
        self.txt = txt

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

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

h.t = j
h.v = e
j.v = e
j.t = a
j.w = d
d.v = j
d.z = h
d.q = h
e.z = h
a.t = j
a.o = e
a.s = e
a.q = h
a.y = d
a.v = g
g.o = a
g.s = d
assert d.q.t.t.s.z.t.txt == "j"