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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: F = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

j = A("j")
m = B("m")
e = C("e")
l = D("l")
i = E("i")
a = F("a")
h = G("h")
d = B("d")

j.w = e
m.v = i
m.z = i
m.r = a
e.p = d
e.v = a
e.t = h
l.y = m
i.z = e
i.o = d
i.q = a
a.w = e
a.z = j
h.p = j
h.o = e
d.v = i
d.z = i
d.r = a
assert j.w.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: F = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

j = A("j")
m = B("m")
e = C("e")
l = D("l")
i = E("i")
a = F("a")
h = G("h")
d = B("d")

j.w = e
m.v = i
m.z = i
m.r = a
e.p = d
e.v = a
e.t = h
l.y = m
i.z = e
i.o = d
i.q = a
a.w = e
a.z = j
h.p = j
h.o = e
d.v = i
d.z = i
d.r = a
assert j.w.t.o.txt == "e"