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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: B = None
        self.w: B = None
        self.txt = txt

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

m.w = d
i.v = f
i.q = d
d.y = k
d.u = j
l.t = d
l.o = i
l.q = j
k.t = i
j.y = f
f.t = d
f.o = i
f.w = i
e.t = d
e.o = i
e.q = j
assert j.y.t.y.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: B = None
        self.w: B = None
        self.txt = txt

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

m.w = d
i.v = f
i.q = d
d.y = k
d.u = j
l.t = d
l.o = i
l.q = j
k.t = i
j.y = f
f.t = d
f.o = i
f.w = i
e.t = d
e.o = i
e.q = j
assert j.y.t.y.t.q.txt == "d"