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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: B = None
        self.t: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.r: A = None
        self.x: E = None
        self.txt = txt

i = A("i")
f = B("f")
n = C("n")
a = D("a")
e = E("e")
c = F("c")
b = G("b")

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: B = None
        self.t: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.r: A = None
        self.x: E = None
        self.txt = txt

i = A("i")
f = B("f")
n = C("n")
a = D("a")
e = E("e")
c = F("c")
b = G("b")

i.z = b
i.u = a
i.r = e
f.t = n
f.u = n
f.s = n
f.v = e
f.y = e
f.x = i
f.p = a
n.o = c
n.r = c
n.v = i
a.r = e
a.t = e
a.w = f
e.r = c
c.o = n
c.r = e
b.q = f
b.p = f
b.r = i
b.x = e
assert a.t.r.r.r.r.txt == "e"