class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

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

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

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

e.x = d
e.t = c
f.x = d
d.w = f
i.u = n
i.o = f
a.w = i
c.o = d
c.t = e
n.p = d
n.y = i
n.o = e
assert f.x.w.x.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

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

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

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

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

e.x = d
e.t = c
f.x = d
d.w = f
i.u = n
i.o = f
a.w = i
c.o = d
c.t = e
n.p = d
n.y = i
n.o = e
assert f.x.w.x.w.x.txt == "d"