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

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

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

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

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

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

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

j = A("j")
n = B("n")
e = C("e")
l = D("l")
d = E("d")
b = F("b")
f = G("f")

j.s = n
n.o = f
e.q = l
e.r = f
l.u = f
l.r = f
l.x = n
l.z = n
l.t = d
d.r = f
d.s = f
d.t = b
d.o = j
b.z = n
f.r = j
assert e.r.r.s.o.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

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

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

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

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

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

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

j = A("j")
n = B("n")
e = C("e")
l = D("l")
d = E("d")
b = F("b")
f = G("f")

j.s = n
n.o = f
e.q = l
e.r = f
l.u = f
l.r = f
l.x = n
l.z = n
l.t = d
d.r = f
d.s = f
d.t = b
d.o = j
b.z = n
f.r = j
assert e.r.r.s.o.r.s.txt == "n"