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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.x: F = None
        self.p: G = None
        self.w: G = None
        self.o: D = None
        self.r: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: G = None
        self.q: F = None
        self.w: C = None
        self.txt = txt

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

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

i = A("i")
c = B("c")
m = C("m")
k = D("k")
h = E("h")
n = F("n")
j = G("j")

i.r = h
c.s = j
c.p = j
c.w = j
c.x = n
c.o = k
c.r = m
m.p = k
k.r = h
k.x = i
h.o = c
h.s = j
h.q = n
h.w = m
n.u = m
j.q = m
j.o = m
j.x = m
j.y = n
j.u = i
assert j.y.u.p.r.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.x: F = None
        self.p: G = None
        self.w: G = None
        self.o: D = None
        self.r: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: G = None
        self.q: F = None
        self.w: C = None
        self.txt = txt

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

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

i = A("i")
c = B("c")
m = C("m")
k = D("k")
h = E("h")
n = F("n")
j = G("j")

i.r = h
c.s = j
c.p = j
c.w = j
c.x = n
c.o = k
c.r = m
m.p = k
k.r = h
k.x = i
h.o = c
h.s = j
h.q = n
h.w = m
n.u = m
j.q = m
j.o = m
j.x = m
j.y = n
j.u = i
assert j.y.u.p.r.s.u.txt == "i"