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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: B = None
        self.r: B = None
        self.q: D = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: A = None
        self.s: C = None
        self.x: E = None
        self.r: F = None
        self.o: A = None
        self.v: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.z: B = None
        self.r: B = None
        self.q: D = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: A = None
        self.s: C = None
        self.x: E = None
        self.r: F = None
        self.o: A = None
        self.v: E = None
        self.txt = txt

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

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