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

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

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

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

j = A("j")
f = B("f")
d = C("d")
e = D("e")
b = D("b")
c = C("c")
g = D("g")
a = B("a")

j.q = d
j.z = b
f.w = a
f.s = d
f.u = j
f.v = c
d.z = j
d.x = j
d.t = c
d.v = f
e.w = j
e.y = j
e.u = g
b.w = j
b.y = j
b.u = e
c.z = j
c.x = j
c.t = d
c.v = f
g.w = j
g.y = j
g.u = e
a.w = f
a.s = c
a.v = c
a.u = j
assert g.u.u.y.z.w.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: D = None
        self.txt = txt

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

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

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

j = A("j")
f = B("f")
d = C("d")
e = D("e")
b = D("b")
c = C("c")
g = D("g")
a = B("a")

j.q = d
j.z = b
f.w = a
f.s = d
f.u = j
f.v = c
d.z = j
d.x = j
d.t = c
d.v = f
e.w = j
e.y = j
e.u = g
b.w = j
b.y = j
b.u = e
c.z = j
c.x = j
c.t = d
c.v = f
g.w = j
g.y = j
g.u = e
a.w = f
a.s = c
a.v = c
a.u = j
assert g.u.u.y.z.w.q.v.txt == "f"