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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: F = None
        self.v: B = None
        self.q: A = None
        self.o: G = None
        self.r: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

a.y = l
b.u = d
b.r = d
l.q = a
l.r = a
l.v = a
l.z = b
l.x = e
l.s = k
d.u = l
d.y = l
d.z = k
d.r = k
d.v = b
d.q = a
d.o = c
e.y = k
e.w = l
k.t = c
k.v = l
c.w = e
c.y = l
c.s = d
assert l.x.y.v.s.t.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: F = None
        self.v: B = None
        self.q: A = None
        self.o: G = None
        self.r: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

a.y = l
b.u = d
b.r = d
l.q = a
l.r = a
l.v = a
l.z = b
l.x = e
l.s = k
d.u = l
d.y = l
d.z = k
d.r = k
d.v = b
d.q = a
d.o = c
e.y = k
e.w = l
k.t = c
k.v = l
c.w = e
c.y = l
c.s = d
assert l.x.y.v.s.t.y.s.txt == "k"