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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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