class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: A = None
        self.v: B = None
        self.txt = txt

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

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

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

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

f = A("f")
e = B("e")
m = C("m")
i = D("i")
j = E("j")
l = F("l")
h = G("h")

f.o = i
f.w = i
e.s = i
e.p = i
e.t = f
m.y = l
m.w = f
m.v = e
i.r = f
i.w = j
i.x = h
j.z = h
j.x = i
l.r = j
h.y = f
h.o = f
h.x = j
assert e.t.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.w: A = None
        self.v: B = None
        self.txt = txt

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

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

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

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

f = A("f")
e = B("e")
m = C("m")
i = D("i")
j = E("j")
l = F("l")
h = G("h")

f.o = i
f.w = i
e.s = i
e.p = i
e.t = f
m.y = l
m.w = f
m.v = e
i.r = f
i.w = j
i.x = h
j.z = h
j.x = i
l.r = j
h.y = f
h.o = f
h.x = j
assert e.t.o.w.txt == "j"