class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: E = None
        self.y: B = None
        self.r: B = None
        self.x: C = None
        self.t: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: B = None
        self.w: E = None
        self.t: E = None
        self.txt = txt

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

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

l.q = f
l.x = f
l.z = i
l.y = a
l.r = a
l.t = e
a.x = l
f.s = i
f.t = l
b.o = l
b.w = a
i.s = f
i.x = f
i.u = b
e.y = b
e.o = a
e.w = i
e.t = i
d.p = l
d.o = f
assert a.x.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: E = None
        self.y: B = None
        self.r: B = None
        self.x: C = None
        self.t: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: D = None
        self.o: B = None
        self.w: E = None
        self.t: E = None
        self.txt = txt

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

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

l.q = f
l.x = f
l.z = i
l.y = a
l.r = a
l.t = e
a.x = l
f.s = i
f.t = l
b.o = l
b.w = a
i.s = f
i.x = f
i.u = b
e.y = b
e.o = a
e.w = i
e.t = i
d.p = l
d.o = f
assert a.x.x.t.txt == "l"