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

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: B = None
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: D = None
        self.r: D = None
        self.s: D = None
        self.w: B = None
        self.x: A = None
        self.txt = txt

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

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

e.o = i
e.p = m
b.o = j
b.w = m
b.v = e
b.r = e
c.v = g
c.s = b
c.u = m
g.v = j
g.x = i
m.o = c
m.r = b
j.q = g
j.v = g
j.r = g
j.s = g
j.w = b
j.x = e
i.r = g
assert i.r.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: B = None
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.v: F = None
        self.x: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: D = None
        self.r: D = None
        self.s: D = None
        self.w: B = None
        self.x: A = None
        self.txt = txt

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

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

e.o = i
e.p = m
b.o = j
b.w = m
b.v = e
b.r = e
c.v = g
c.s = b
c.u = m
g.v = j
g.x = i
m.o = c
m.r = b
j.q = g
j.v = g
j.r = g
j.s = g
j.w = b
j.x = e
i.r = g
assert i.r.v.x.txt == "e"