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

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

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

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

l.u = g
l.x = b
m.r = a
m.y = g
m.t = l
m.o = e
m.q = b
g.u = l
f.t = a
f.p = a
f.v = b
f.q = b
f.z = g
f.o = l
a.q = b
a.z = f
e.x = a
e.u = f
b.s = f
assert a.z.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.x: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

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

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

l.u = g
l.x = b
m.r = a
m.y = g
m.t = l
m.o = e
m.q = b
g.u = l
f.t = a
f.p = a
f.v = b
f.q = b
f.z = g
f.o = l
a.q = b
a.z = f
e.x = a
e.u = f
b.s = f
assert a.z.q.s.txt == "f"