class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: C = None
        self.v: B = None
        self.o: C = None
        self.p: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: E = None
        self.x: A = None
        self.o: F = None
        self.p: D = None
        self.q: G = None
        self.txt = txt

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

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

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

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

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

i.t = d
i.r = e
i.o = e
i.v = f
i.p = a
f.o = h
e.u = d
e.w = d
e.x = i
e.o = m
e.p = h
e.q = a
h.u = f
h.p = m
d.p = i
m.o = i
m.x = e
a.y = f
a.t = f
assert m.x.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: C = None
        self.v: B = None
        self.o: C = None
        self.p: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: E = None
        self.x: A = None
        self.o: F = None
        self.p: D = None
        self.q: G = None
        self.txt = txt

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

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

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

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

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

i.t = d
i.r = e
i.o = e
i.v = f
i.p = a
f.o = h
e.u = d
e.w = d
e.x = i
e.o = m
e.p = h
e.q = a
h.u = f
h.p = m
d.p = i
m.o = i
m.x = e
a.y = f
a.t = f
assert m.x.q.t.txt == "f"