class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: F = None
        self.q: D = None
        self.y: D = None
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: F = None
        self.o: F = None
        self.z: F = None
        self.y: G = None
        self.txt = txt

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

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

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

d.w = j
d.p = j
d.r = i
d.q = e
d.y = e
g.x = a
a.u = i
a.r = f
e.r = i
e.w = d
j.v = d
j.s = i
j.o = i
j.z = i
j.y = f
i.w = g
f.z = i
assert e.r.w.x.u.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: F = None
        self.q: D = None
        self.y: D = None
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: F = None
        self.o: F = None
        self.z: F = None
        self.y: G = None
        self.txt = txt

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

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

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

d.w = j
d.p = j
d.r = i
d.q = e
d.y = e
g.x = a
a.u = i
a.r = f
e.r = i
e.w = d
j.v = d
j.s = i
j.o = i
j.z = i
j.y = f
i.w = g
f.z = i
assert e.r.w.x.u.w.x.txt == "a"