class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: E = None
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: B = None
        self.o: F = None
        self.t: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: G = None
        self.v: D = None
        self.y: E = None
        self.u: E = None
        self.x: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: C = None
        self.v: A = None
        self.z: C = None
        self.txt = txt

e = A("e")
f = B("f")
n = C("n")
l = D("l")
i = E("i")
h = F("h")
m = G("m")

e.y = i
f.z = n
f.r = l
n.q = f
n.p = f
n.v = l
n.r = h
n.s = m
n.t = i
l.p = n
l.r = i
l.x = h
i.r = e
i.u = f
i.t = f
i.o = h
h.r = f
h.w = m
h.v = l
h.y = i
h.u = i
h.x = e
m.s = l
m.u = n
m.z = n
m.v = e
assert e.y.r.y.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: E = None
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: B = None
        self.o: F = None
        self.t: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: G = None
        self.v: D = None
        self.y: E = None
        self.u: E = None
        self.x: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: C = None
        self.v: A = None
        self.z: C = None
        self.txt = txt

e = A("e")
f = B("f")
n = C("n")
l = D("l")
i = E("i")
h = F("h")
m = G("m")

e.y = i
f.z = n
f.r = l
n.q = f
n.p = f
n.v = l
n.r = h
n.s = m
n.t = i
l.p = n
l.r = i
l.x = h
i.r = e
i.u = f
i.t = f
i.o = h
h.r = f
h.w = m
h.v = l
h.y = i
h.u = i
h.x = e
m.s = l
m.u = n
m.z = n
m.v = e
assert e.y.r.y.u.r.txt == "l"