class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: C = None
        self.q: E = None
        self.v: B = None
        self.o: B = None
        self.t: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: A = None
        self.o: A = None
        self.v: C = None
        self.w: C = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: C = None
        self.q: E = None
        self.v: B = None
        self.o: B = None
        self.t: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: A = None
        self.o: A = None
        self.v: C = None
        self.w: C = None
        self.txt = txt

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

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

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

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