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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: G = None
        self.u: A = None
        self.x: E = None
        self.w: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: G = None
        self.z: G = None
        self.w: G = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
c = C("c")
g = D("g")
a = E("a")
f = F("f")
j = G("j")

e.r = m
m.u = e
c.y = a
c.o = j
c.q = e
g.o = c
g.q = j
g.u = e
g.x = a
g.w = f
a.p = e
a.q = j
a.z = j
a.w = j
f.p = c
f.y = m
j.z = m
j.q = c
j.p = f
assert j.p.p.y.p.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: G = None
        self.u: A = None
        self.x: E = None
        self.w: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: G = None
        self.z: G = None
        self.w: G = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
c = C("c")
g = D("g")
a = E("a")
f = F("f")
j = G("j")

e.r = m
m.u = e
c.y = a
c.o = j
c.q = e
g.o = c
g.q = j
g.u = e
g.x = a
g.w = f
a.p = e
a.q = j
a.z = j
a.w = j
f.p = c
f.y = m
j.z = m
j.q = c
j.p = f
assert j.p.p.y.p.r.u.r.txt == "m"