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

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.x: C = None
        self.w: F = None
        self.y: B = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

f = A("f")
g = B("g")
e = C("e")
j = D("j")
i = E("i")
k = F("k")
m = G("m")
d = B("d")

f.r = m
f.s = i
f.u = k
f.o = j
g.z = m
g.x = e
g.w = k
g.y = d
e.s = i
e.p = i
j.s = i
i.y = j
i.t = m
k.s = m
m.t = j
d.z = m
d.x = e
d.w = k
d.y = g
assert e.s.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.s: E = None
        self.u: F = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.x: C = None
        self.w: F = None
        self.y: B = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.t: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

f = A("f")
g = B("g")
e = C("e")
j = D("j")
i = E("i")
k = F("k")
m = G("m")
d = B("d")

f.r = m
f.s = i
f.u = k
f.o = j
g.z = m
g.x = e
g.w = k
g.y = d
e.s = i
e.p = i
j.s = i
i.y = j
i.t = m
k.s = m
m.t = j
d.z = m
d.x = e
d.w = k
d.y = g
assert e.s.t.t.txt == "j"